Schedule 200 calls for contacts with a Button based on the view that the button is in

Schedule 200 calls for contacts with a Button based on the view that the button is in

Hi Everyone

Hopep you are well.

I need some help nailing this code down.

I need to create a butotn that generates 200 calls for contacts. The button will be placed in the contacts module and will need to generate the calls for the contacts based on  the custom view that it is currently in.

Below is the code I am using the to schedule the calls, I am battling to figure out how to point it to the view it is currently in

  1. contactList = zoho.crm.getRecords("Contacts",1,1,{"cvid":"6101631000000087529"});
  2. for each  contact in contactList
  3. {
  4. mp = Map();
  5. contactDetails = zoho.crm.getRecordById("Contacts",contactId);
  6. acctname = ifnull(contactDetails.get("Account_Name"),"");
  7. if(acctname != "")
  8. {
  9. acctid = acctname.get("id");
  10. accountDetails = zoho.crm.getRecordById("Accounts",acctid);
  11. mp.put("$se_module","Accounts");
  12. mp.put("What_Id",acctid);
  13. }
  14. mp.put("Subject","compcallpurpose");
  15. mp.put("Call_Purpose","compcallpurpose");
  16. mp.put("Owner",zoho.loginuserid);
  17. mp.put("Call_Type","Outbound");
  18. mp.put("Who_Id",contactId);
  19. mp.put("Call_Start_Time",today);
  20. // mp.put("$which_call","ScheduleCall");
  21. create = zoho.crm.createRecord("Calls",mp);
  22. }
  23. return "";