ZOHO.CRM.API.delinkRelatedRecord(config) |
Name | Type | Description |
Entity | String | API Name of the module. |
RecordID | String | RecordID of the entity whose associated details are required. |
RelatedListName | String | API Name of the relatedList of the entity. |
RelatedRecordID | String | Related Record ID. |
ZOHO.CRM.API.delinkRelatedRecord({Entity:"Contacts",RecordID:"43426879776433",RelatedList:"Deals",RelatedRecordID:"7678567456858"}) .then(function(data){ console.log(data) }) |
Util={}; function initializeWidget() { // Event Listener triggered when the entity page is loaded ZOHO.embeddedApp.on("PageLoad",function(data) { //Fetching the entity ID of the current page that is loaded contactid=data.EntityId; entityname=data.Entity; /*Fetching all the deals that are related with the contact using the getRelatedRecords method. Passing the value of RelatedList as Deals and Entity as Contacts to the getRealtedRecords method.*/ ZOHO.CRM.API.getRelatedRecords({Entity:"Contacts",RecordID:contactid,RelatedList:"Deals",page:1,per_page:200}) .then(function(data){ temp=data; rec=data.data; console.log(data); $('#dealidlist').empty(); //Looping through the deals for (i = 0; i < rec.length; i++) { /*Creating a list called dealidlist. Populating the dealidlist with the names of all the deals associated with the contact, when the GetDeals button is clicked*/ dealid=rec[i].id; dealname=rec[i].Deal_Name; var dealidlist = document.getElementById("dealidlist"); var option = document.createElement("OPTION"); option.innerHTML = dealname; option.value = dealid; dealidlist.appendChild(option); } }) //Functionality of Delink deals button Util.delink=function() { /*The deal selected from the dealidlist is passed as RelatedRecordID value, to the delinkRelatedRecord method. Delinking the deal selected from the dealidlist and thereby dissociating it from the contact*/ ZOHO.CRM.API.delinkRelatedRecord({Entity:"Contacts",RecordID:contactid,RelatedList:"Deals",RelatedRecordID:document.getElementById("dealidlist").value}) .then(function(data){ console.log(data) }) ZOHO.CRM.UI.Popup.close() .then(function(data){ console.log(data) }) }; //Functionality of the cancel button Util.cancel=function() { //closes the widget window ZOHO.CRM.UI.Popup.close() .then(function(data){ console.log(data) }) }; }) //Initializing the widget ZOHO.embeddedApp.init(); } |
Writer is a powerful online word processor, designed for collaborative work.