-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnClickCreateLead.htm
94 lines (80 loc) · 3.97 KB
/
OnClickCreateLead.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0088)http://code.google.com/apis/maps/documentation/javascript/examples/map-simple-async.html -->
<HTML><HEAD><TITLE>Google Maps JavaScript API v3 Example: Map Simple</TITLE>
<META name=viewport content="initial-scale=1.0, user-scalable=no">
<META content="text/html; charset=UTF-8" http-equiv=content-type>
<STYLE type=text/css>HTML {
HEIGHT: 100%
}
BODY {
PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 100%; PADDING-TOP: 0px
}
#map_canvas {
WIDTH: 400px; HEIGHT: 500px
}
</STYLE>
<SCRIPT type=text/javascript>
var map;
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882, 131.044922);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'click', function (event) {
placeMarker(event.latLng);
});
}
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
function placeMarker(location) {
var clickedLocation = new google.maps.LatLng(location);
var marker = new google.maps.Marker({
position: location,
map: map
});
///////////////////////////////////////////////////////////
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
" <soap:Header>" +
" <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>" +
" <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">Respina</OrganizationName>" +
" <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>" +
" </CrmAuthenticationToken>" +
" </soap:Header>" +
" <soap:Body>" +
" <Create xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <entity xsi:type=\"lead\">" +
" <address1_latitude>" + location.lat() + "</address1_latitude>" +
" <address1_longitude>" + location.lng() + "</address1_longitude>" +
" <firstname>Test '</firstname>" +
" </entity>" +
" </Create>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
//alert(resultXml.xml);
///////////////////////////////////////////////////////////
//alert(location.lat() + ' ' + location.lng());
map.setCenter(location);
}
</script>
<META name=GENERATOR content="MSHTML 8.00.7600.16385"></HEAD>
<BODY>
<DIV id=map_canvas style='width:auto; height:100%;'></DIV></BODY></HTML>