Update a field in Contacts from a custom module
Hi,
I have this function which works very well. It updates a date-type field in Contact from a custom module.
- custinfo = zoho.crm.getRecordById("Vingo_Ride",custid.toLong());
- ctime = custinfo.get("Ride_date");
- relcont = zoho.crm.searchRecords("Contacts","(Email:equals:" + email + ")");
- if(relcont.size() > 0)
- {
- for each rec in relcont
- {
- contid = rec.getJSON("id");
- break;
- }
- update = zoho.crm.updateRecord("Contacts",contid.toLong(),{"Last_Ride_date":ctime.toDate()});
- update1 = zoho.crm.updateRecord("Vingo_Rides",custid.toLong(),{"Contacts_Name":contid.toLong()});
- }
I would like to do the same thing for the another text field from the same custom module.
I duplicate the function and the workflow. Edited what needed to change and tried to adapt the function, since the field to update is not a date field.
The workflow tells me that each test is a success, but I don't see anythin being populated in Contacts.
What am I doing wrong?
Here is the function I am using:
custinfo = zoho.crm.getRecordById("Vingo_Ride",custid.toLong());
ctime = custinfo.get("Route_Completed");
relcont = zoho.crm.searchRecords("Contacts","(Email:equals:" + email + ")");
if(relcont.size() > 0)
{
for each rec in relcont
{
contid = rec.getJSON("id");
break;
}
update = zoho.crm.updateRecord("Contacts",contid.toLong(),{"Last_Route_Completed_Yes_No":custid.toLong()});
update1 = zoho.crm.updateRecord("Vingo_Rides",custid.toLong(),{"Contacts_Name":contid.toLong()});
}
Thank you so much!