I'm creating some custom script in Zoho Flow to associate the Zoho Projects Client Company. I've got the find piece of the code working but I want to update the found record with the CRM ID
Here is my code
- string ZP_getClientID(string varClientName, string varCRMID)
{
response = invokeurl
[
url :"https://projectsapi.zoho.eu/restapi/portal/MYPORTAL/clients/"
type :GET
connection:"MY CONNECTION"
];
// Change the response to a map to extract specific information
varClients = response.get("clients");
//
// iterate the list of clients to match the CRM Account ID
for each varRecord in varClients
{
clientanme = varRecord.getJSON("name");
if(clientanme = varClientName)
{
primaryclientid = varRecord.get("id");
}
}
//Update the CRM ID in projects
crmInfo = Map();
crmInfo.put("crm_account_id",varCRMID);
updateresponse = invokeurl
[
url :"https://projectsapi.zoho.eu/restapi/portal/MYPORTAL/projects/91102000002038530/clients/"
type :POST
parameters:crmInfo
connection:"MY CONNECTION"
];
info updateresponse;
return primaryclientid;
}