How to Send Weekly Scheduled Emails of a Custom View

How to Send Weekly Scheduled Emails of a Custom View

Greetings,

We have a custom view called "All Employee View" for the Employee form.

We are able to manually export that view using the "Export" button:


However, we want to programmatically export this view as an XLS file each week and send it in an email attachment. For this, I tried the following Scheduler Deluge code, but the viewId part to get the data as in the custom view is not working.

  1. report = Map();
  2. report = zoho.people.getRecords("P_Employee",0,200,{"cvid":"<viewId from the URL>"});
  3. myfile = report.toFile("myfile.csv");
  4. sendmail
  5. [
  6. from :zoho.loginuserid
  7. to :"<myemail>"
  8. subject :"test"
  9. message :report
  10. Attachments :file:myfile
  11. ]

Please let me know if I am on the right track.

Thanks.