Name | Type | Description |
Entity | String | SysRefName of the module. |
RecordID | String | The ID of the record to open or edit. |
Target | String | Allowed values "_blank". To open the create/edit/open page of the record in a new tab. |
ZOHO.CRM.API.attachFile(config) |
Name | Type | Description |
Entity | String | SysRefName of the module. |
RecordID | String | The record ID for which the attachment is to be associated. |
File | Object | File object to be attached. |
Name | Type | Description |
Name | String | The name of the file. |
Content | Object | The file content. |
ZOHO.CRM.API.addNotes(config) |
Name | Type | Description |
Entity | String | SysRefName of the module. |
RecordID | String | The record ID for which the note is to be associated. |
Title | String | The title for the note. |
Content | String | The note content. |
Util={}; var EntityIds; var EntityName; var temp; //Subscribe to the EmbeddedApp onPageLoad event before initializing the widget ZOHO.embeddedApp.on("PageLoad",function(data) { EntityIds=data.EntityId[0]; EntityName=data.Entity; //Getting the product-related details of the deal using getRelatedRecords API ZOHO.CRM.API.getRelatedRecords({Entity:EntityName,RecordID:EntityIds,RelatedList:"Products",page:1,per_page:200}) .then(function(data){ temp=data; rec=data.data; console.log(data); $('#prodidlist').empty(); //Looping through the products for (i = 0; i < rec.length; i++) { /*populating the prodidlist list with the product names of all the products associated with the deal*/ prodid=rec[i].id; prodname=rec[i].Product_Name; var prodidlist = document.getElementById("prodidlist"); var option = document.createElement("OPTION"); option.innerHTML = prodname; option.value = prodid; prodidlist.appendChild(option); } }) /*Viewing the complete details page of the selected product from the prodidlist using the record open API*/ Util.view=function() { ZOHO.CRM.UI.Record.open({Entity:"Products",RecordID:document.getElementById("prodidlist").value,Target:"_blank"}) .then(function(data){ console.log(data) }) } Util.delink=function() { //Delinking the product selected from the product list and thereby dissociating it from the deal ZOHO.CRM.API.delinkRelatedRecord({Entity:EntityName,RecordID:EntityIds,RelatedList:"Products",RelatedRecordID:document.getElementById("prodidlist").value}) .then(function(data){ console.log(data) }) var filesToLoad = document.getElementById("fileInputTag").files; var filename=filesToLoad[0].name; if(filesToLoad) { var file = filesToLoad[0]; ZOHO.CRM.API.attachFile({Entity:EntityName,RecordID:EntityIds,File:{Name:filename,Content:file}}) .then(function(data){ console.log(data); }); } // Adding the input value provided as a note to be associated with the deal ZOHO.CRM.API.addNotes({Entity:EntityName,RecordID:EntityIds,Title:"Delink Notes",Content:document.getElementById("notes").value}).then(function(datas){ console.log(datas); }); ZOHO.CRM.UI.Popup.close() .then(function(data){ console.log(data) }) }; }) |
Writer is a powerful online word processor, designed for collaborative work.