Automation-Custom Scheduler

Custom Scheduler

Purpose

Custom Functions allows you to customize a lot of commonly used functions thereby helping you save time. Custom Scheduler is an add-on to the existing Custom Functions. Using the Custom Scheduler, you will be able to create a scheduler which will automatically perform the actions of a particular Custom Function, at the time specified by you. While custom functions will be triggered based on workflow actions, custom schedulers do not need any workflow actions for them to get triggered. 

Creating a Custom Scheduler

  • From your home page, go to Setup (Gear icon) > Automation > Custom Scheduler > Add Scheduler
  • Give a name for the Scheduler
  • Give a Start Date and Time
  • Set Frequency
  • Under Time Zone, select your desired time zone
  • In the Custom Function Editor, update the respective script

  • Click Save

Note: For Weekly scheduler, you will be able to select the day on which the schedule should run, by using the dropdown. For Monthly scheduler, you will have the option to select the date and for Yearly scheduler, you will be able to select the Month and Date on which the scheduler should run.

Example scenario -Salary Processing

Consider a scenario where you need to update the Salary form based on the 27th of every month based on various other values like mediclaim amount, other reimbursement amount etc. In this case, you can create a scheduler for this date, to take values from multiple forms to update your salary details form.

Follow the steps given below to do this.

Note: You need to have the forms and fields used in the script available in your account for you to use this function.

  • From your home page, go to Setup (Gear icon) > Automation > Custom Scheduler > Add Scheduler
  • Give the Scheduler Name as 'Reimbursement details'
  • Under Start date give 27
  • Under Time, specify the desired time
  • Under Frequency, select Month, and choose 27 under Dates
  • In the Custom Function Editor, paste the script given below

salarydetails = Map();

salarydetails = zoho.people.getRecordById("Salary_reference",recordid);

tabularmap = Map();

tabularmap = salarydetails.get("tabularSections");

tabularlist = List();

tabularlist = tabularmap.get("Breakup details");

salarymap = Map();

Totalsalary = 0;

for each r in tabularlist

{

salarymap = r.toMap();

Totalsalary = salarymap.get("HRA1").toDecimal() + salarymap.get("Other_Allowance1").toDecimal() + salarymap.get("Medical1").toDecimal() + salarymap.get("Basic1").toDecimal();

}

salaryupdate = Map();

salaryvalue = Map();

salaryvalue.put("recordid",recordid);

salaryvalue.put("Net_Salary",Totalsalary.toString());

salaryvalue.put("Revised_date",today.toString());

salaryupdate = zoho.people.update("Salary_reference",salaryvalue);

info salaryupdate;

 

This function will add salary details from salary reference form to the Monthly salary form.

getdata = List();

getdata = zoho.people.getRecords("Salary_reference");

addata = Map();

addrecord = Map();

This will iterate all the entries and update it to Salary detials form on specifiying current date.

 

for each r in getdata

{

mon_salary = r.get("Net_Salary");

erecno = r.get("Employee_ID.ID");

addata.put("Employee_ID",erecno);

addata.put("Montly_Salary",mon_salary);

addata.put("Date_1",today.toString());

addrecord = zoho.people.create("Monthly_Salary_Details",addata);

}

putrecord = Map();

updaterecord = Map();

putrecord.put("recordid",recordid); putrecord.put("Sch_date",datevalue.toString());

updaterecord = zoho.people.update("Schedular_form",putrecord);

info updaterecord;

  • Click Save

Once this scheduler is created, a scheduler will be pushed on the 27th of every month to update the salary form based on details from other forms.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohopeople.com