Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created October 24, 2021 23:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeznag/f717f5cd81de4e6e2429fc4e73decb0a to your computer and use it in GitHub Desktop.
Save jeznag/f717f5cd81de4e6e2429fc4e73decb0a to your computer and use it in GitHub Desktop.
Using client script to retrieve data from the Zoho CRM API
const userId = $Crm.user.id;
const userData = ZDK.Apps.CRM.Users.fetchById(userId);
let phoneNumber = userData._phone;
const twilioFromNumberRecords = ZDK.Apps.CRM.Twiliosmsextension0__Twilio_From_Numbers.searchByCriteria(`Owner:equals:${userId}`);
if (twilioFromNumberRecords.length > 0) {
phoneNumber = twilioFromNumberRecords[0]._Name;
}
const callbackNumberField = ZDK.UI.getElementByID('callback_number');
callbackNumberField.setContent(phoneNumber);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment