Zoho CRM workflow.

Zoho CRM workflow.

Hello everyone I am a bit confused about this one.


I made a function that I assign to a workflow that runs each time an Accounts is modified/created. 


The function is to take the account ID and fetch data from Zoho BOOKS and the contact module in the CRM.


If I run the deluge myself it works 100 % of the time. But if I let the workflow run the script the following 2 variables are empty. accountNumber and fullname.


Here is the function


  1. response = zoho.crm.getRecordById("Accounts",accountid);
  2. contact = zoho.crm.searchRecords("Contacts","((Account_Name:equals:" + response.get("Account_Name") + ") AND (Main_Contact_for_Account:equals:Yes))");
  3. for each  res in contact
  4. {
  5. fullname = res.get("First_Name") + " " + res.get("Last_Name");
  6. }
  7. if(response.get("Main_Account_Contact") != fullname)
  8. {
  9. zoho.crm.updateRecord("Accounts",accountid,{"Main_Account_Contact":fullname});
  10. }
  11. books = zoho.books.getRecords("Contacts",orgid,{"zcrm_account_id":accountid});
  12. books = books.get("contacts");
  13. for each  book in books
  14. {
  15. accountNumber = book.get("cf_num_ro");
  16. }
  17. if(response.get("Num_ro") != accountNumber)
  18. {
  19. zoho.crm.updateRecord("Accounts",accountid,{"Num_ro":accountNumber});
  20. }



If someone can point me in the right direction is it because the workflow does not have access. Running with the 2 internal connection 


Any help would be very nice thanks.