Check Contacts for scheduled calls
HI guys!
I really hope sonmeone can help, I am battling with the logic of my code. Here is the use case scenarion, we heavily use the call smodule in ZOHO, i have a workflow that triggers and schedules calls dependinf on the outcome of a call.
We have some contacts ( and by extension, Accounts) that dont have scheduled calls against them. We have few thousand Contacts loaded already. I need the code to check which accounts dont have any scheduled calls or any calls at all. I can get the checking for calls at all part right, but where I am battling is that if a contact has a completed call, but not a SCHEDULED call, the code is still picking it up as having a scheduled call, even though the call on that contact is in the past and has been completed. Below is the code, please can you help me understand where its going wrong.
- loop = {1,2,3};
- alist = List();
- for each ele in loop
- {
- resp = zoho.crm.getRecords("Accounts",ele,200);
- if(resp.size() == 0)
- {
- break;
- }
- for each rec in resp
- {
- Val = "";
- relcont = zoho.crm.getRelatedRecords("Contacts","Accounts",rec.get("id"));
- if(relcont.size() != 0)
- {
- for each ele in relcont
- {
- relcalls = zoho.crm.getRelatedRecords("Calls","Contacts",ele.get("id"));
- if(relcalls.size() = 0)
- {
- alist.add(rec.get("id"));
- }
- else if(relcalls.size() != 0)
- {
- for each call in relcalls
- {
- ctime = call.get("Call_Start_Time").toTime("yyyy-MM-dd'T'HH:mm:ss");
- if ((ctime > now) && (relcalls.size() > 0))
- {
- Val = "Yes";
- }
- }
- }
- }
- }
- }
- if(Val == "")
- {
- alist.add(rec.get("id"));
- }
- }
- info "Account Count : " + alist.size();
- info "Account List : " + alist;
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.