account = zoho.crm.getRecordById("Accounts",AccountId);
// customization block:
// replace your client id and api key here
// you can find the client id and api key in Ideolve console - Profile - Connect to other apps - Select Zoho CRM - choose tab : Configure ZohoCRM
connectorClientId = "replace your client id here"
apiKey = "replace your api key here"
info account;
keys = {"Owner","Account_Status","Account_Type","Industry","Parent_Account","Annual_Revenue","Employees","Website","Fax","Phone","Rating","SIC_Code","Name_Partner","Name_Distributor","Currency","Mithi_Products","Billing_Street","Billing_City","Billing_State","Billing_Code","Billing_Country","Shipping_Street","Shipping_City","Shipping_State","Shipping_Code","Shipping_Country","Description"};
notetext = "#Account";
for each key in keys
{
keyvalue = account.get(key);
if(!keyvalue.isNull())
{
info keyvalue;
notetext = notetext + "
" + key + " : " + keyvalue;
}
}
tags = "";
tagList = account.getJSON("Tag");
for each tag in tagList
{
tags = tags + tag.get("name");
tags = tags + ", ";
}
if(tags != "")
{
notetext = notetext + "
Tags : " + tags;
}
sub = "ACC | " + account.get("Account_Name") + " | " + AccountId;
em = zoho.crm.getRelatedRecords("Contacts","Accounts",AccountId,1,200,{"type":1});
contacts = "";
for each con in em
{
info con;
email = con.getJSON("Email");
contacts = contacts + "
" + email;
}
if(contacts != "")
{
notetext = notetext + "
Account Contacts : " + contacts;
}
header = {"event-origin":"ZohoCRM","event-type":"AddNote","connector-client-id":connectorClientId ,"x-api-key": apiKey,"Content-Type":"application/json"};
// to learn more on sharing with users list or providing permissions to work on the note, refer - https://docs.mithi.com/home/ideolve-api#create-note-api
bodyMp = {"subject":sub,"notehtmltext":notetext,"readonly":true,"sharedtags":{"Account"},"leadNo":AccountId.toString(),"module":"Accounts","users":{"sharewith":{{"group":"CRM"}}}};
response = invokeurl
[
url :"https://api.ideolve.com/v3/connector/event"
type :POST
parameters:bodyMp.toString()
headers:header
];
info response;