Created
October 24, 2021 23:33
-
-
Save jeznag/f717f5cd81de4e6e2429fc4e73decb0a to your computer and use it in GitHub Desktop.
Using client script to retrieve data from the Zoho CRM API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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