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
- response = zoho.crm.getRecordById("Accounts",accountid);
- contact = zoho.crm.searchRecords("Contacts","((Account_Name:equals:" + response.get("Account_Name") + ") AND (Main_Contact_for_Account:equals:Yes))");
- for each res in contact
- {
- fullname = res.get("First_Name") + " " + res.get("Last_Name");
- }
- if(response.get("Main_Account_Contact") != fullname)
- {
- zoho.crm.updateRecord("Accounts",accountid,{"Main_Account_Contact":fullname});
- }
- books = zoho.books.getRecords("Contacts",orgid,{"zcrm_account_id":accountid});
- books = books.get("contacts");
- for each book in books
- {
- accountNumber = book.get("cf_num_ro");
- }
- if(response.get("Num_ro") != accountNumber)
- {
- zoho.crm.updateRecord("Accounts",accountid,{"Num_ro":accountNumber});
- }
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.