How would I create a function to edit all deals in my CRM?
I'm looking to iterate through all of my deals and change a field in each given deal.
1. How do I "get" every single deal in my CRM?
2. How do I "get" each deal's ID so I can reference that deal's ID in pulling the related notes and changing the related fields with each deal?
In my code below, I'm trying to record the last note's content and time in custom fields in CRM.
my code is:
for each deal in all_deals
{
ID = deal.get("id");
info ID;
RelatedNotes = zoho.crm.getRelatedRecords("Notes", "Deals",ID);
//info RelatedNotes;
value = RelatedNotes.get(0).get("Note_Content");
time = RelatedNotes.get(0).get("Created_Time");
info value;
info time;
mp=map();
mp.put("Last_Note",value);
mp.put("Time_Note_Created",time);
update = zoho.crm.updateRecord("Deals",ID,mp);
info mp;
info update;
}