ZOHO Desk Extenstion - Getting Account ID

ZOHO Desk Extenstion - Getting Account ID

Hi, I am trying to create a simple extension for ZOHO desk so that our team can quickly navigate to the accounts and contact records in ZOHO CRM that are linked to the ticket. 

I have gone through the API documentation but cannot seem to get it to work.

Any help would be appreciated

Here is the code I have so far (I have omitted our org number and the CSS)

Hi, I am trying to create a simple extension for ZOHO desk so that our team can quickly navigate to the accounts and contact records in ZOHO CRM that are linked to the ticket. 

I have gone through the API documentation but cannot seem to get it to work.

Any help would be appreciated

Here is the code I have so far (I have omitted our org number and the CSS)

<body>
<div class="stacker">
<a role="button" class="button-name" id="crmAccountButton">CRM Account</a>
<button role="button" class="button-name">CRM Contact</button>
</div>

<script type="text/javascript">
  window.onload = function() {
ZOHODESK.extension.onload().then((App) => {
ZOHODESK.get('ticketForm.accountId').then(function(response) {
if (response.status === 'success') {
var accountId = response['ticketForm.accountId'].id;
var accountName = response['ticketForm.accountId'].name;

var crmAccountButton = document.getElementById('crmAccountButton');
if (crmAccountButton) {
crmAccountButton.href = 'https://crm.zoho.eu/crm/org/tab/Accounts/' + accountId;
crmAccountButton.textContent = 'CRM Account: ' + accountName;
}
} else {
console.error('Error retrieving account information:', response);
}
}).catch(function(err) {
console.error('Error:', err);
});
}) 
  }
</script>
</body>