· 5 years ago · Aug 21, 2020, 10:18 AM
1console.log("DEBUT");
2var crmclient = require('zcrmsdk');
3crmclient.initialize();
4console.log("OK 1");
5input = {};
6input.id = '1456177000166894227'; // id: record-id
7input.module = 'Contacts';
8console.log("OK 2");
9//crmclient.updateOAuthTokens();
10crmclient.API.MODULES.get(input).then(function(response) {
11
12 // Response of the API call is returned in the 'body'
13
14 // The specific record details are obtained from the first JSON object of the JSON Array corresponding
15 // to the 'data' key of the response
16 response = JSON.parse(response.body);
17 console.log(response);
18 response = response.data[0];
19
20 // For obtaining all the fields of the record details, use the value of 'response' as such
21 console.log("OKOK");
22
23 // For obtaining a particular field, use response.<api-name of field>
24 // Sample API names: Website, Email
25 console.log(response.First_Name);
26
27});