-
Notifications
You must be signed in to change notification settings - Fork 15
/
create_contact.html
72 lines (54 loc) · 2.6 KB
/
create_contact.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
</head>
<body>
<h1>Create Contact and Track it</h1>
<h4>Please run this code at some server : (XAMPP OR WAMP OR TOMCAT OR Google APP engine)</h4>
<form name="create_contact_track">
First Name : <input type='text' name = "first_name" id = "f_name" ><br/>
Last Name : <input type='text' name = "first_name" id = "l_name" ><br/>
Email : <input type='email' name = "first_name" id = "email" ><br/><br/>
<input type="button" value="Create Contact in Agile CRM" onclick = "createContact()">
</form>
<script type="text/javascript" src="https://your_domain.agilecrm.com/stats/min/agile-min.js"></script>
<script type="text/javascript" > _agile.set_account('your_JS_key', 'your_domain');
_agile.track_page_view();
_agile_execute_web_rules();
</script>
<script>
function createContact() {
alert('hello');
var email_received = document.getElementById('email').value;
var contact = {};
contact.email = email_received;
contact.first_name = document.getElementById('f_name').value;
contact.last_name = document.getElementById('l_name').value;
contact.company = "abc corp";
contact.title = "lead";
contact.phone = "+1-541-754-3010";
contact.website = "http://www.example.com";
var address = {"city": "new delhi", "state": "delhi", "country": "india"};
contact.address = JSON.stringify(address);
contact.tags = "tag1, tag2";
// Custom fields can be added to contact object as
contact.status = "incomplete";
contact.custom_id = "EN001C";
_agile.create_contact(contact, {
success: function (data) {
// Set Email at success of contact creation. But you can set it at failure too.
_agile.set_email(email_received);
console.log("success");
console.log("Response = "+data);
},
error: function (data) {
console.log("error");
console.log("Error Cause = "+data);
}
});
// Function end
}
</script>
</body>
</html>