Your Zoho People can now become tailor-made with Custom Functions
The power of customization is now increased manifold through the most sought-after feature of Zoho People - Custom Functions.
Given below is a scenario in your everyday HR life, where, Custom Functions can be used to calculate working hours of an employee in case check out is not done on the system by the employee.
Method 1 :
The respective shift's end time is updated as the check out time on the system using Custom Functions.
Steps to do this action:
- Configure a date based workflow(Reminder) - Click here to know how
Note: Mention time of execution based on the need
For example, If this auto-check out needs to be done for the previous day, then under date, you need to give the 'Date of Execution' as before 1 day under the Trigger Process as shown below
- Create custom functions (Click here to know how)
- Map custom functions to the workflow
Code Snippet:
Pre Requisite:
Function Name: Auto-check Shift End Time
Paramaters Required:
recordid = ZohoID(P_AttendanceForm)
erecno = ZohoID(P_EmployeeForm)
Script:
getdata = Map();
getempdata = Map();
addrecord = Map();
tokenvalue= <authtoken>;
updaterecord = Map();
getdata = zoho.people.getRecordById("P_AttendanceForm",recordid);
expcheckout = getdata.get("ExpectedToTime");
checkout = getdata.get("ToTime");
getempdata = zoho.people.getRecordById("employee",erecno);
empid = getempdata.get("EmployeeID");
if(isBlank(checkout))
{
addrecord.put("authtoken",tokenvalue);
addrecord.put("empId",empid);
addrecord.put("checkOut",expcheckout);
updaterecord = postUrl("https://people.zoho.com/people/api/attendance",addrecord);
info updaterecord;
}
Output:
Checkout time = ExpectedToTime(Based on user shift)
Method 2:
"08" hours from check-in time can be updated as check out time on the system using Custom Functions.
The code for this action is given below.
Code Snippet:
Pre Requisite:
Function Name: Auto-check on 8hrs from Checked in
Paramaters Required:
recordid = ZohoID(P_AttendanceForm)
erecno = ZohoID(P_EmployeeForm)
Script:
getdata = Map();
getempdata = Map();
addrecord = Map();
tokenvalue = <authtoken>;
updaterecord = Map();
getdata = zoho.people.getRecordById("P_AttendanceForm",recordid);
expcheckout = getdata.get("ExpectedToTime");
checkout = getdata.get("ToTime");
checkin = getdata.get("FromTime").toTime();
addedhrs= checkin.addHour(8);
getempdata = zoho.people.getRecordById("employee",erecno);
empid = getempdata.get("EmployeeID");
if(isBlank(checkout))
{
addrecord.put("authtoken",tokenvalue);
addrecord.put("empId",empid);
addrecord.put("checkOut",addedhrs.toString());
updaterecord = postUrl("https://people.zoho.com/people/api/attendance",addrecord);
info updaterecord;
}
Output:
Checkout time = Checkin time +8hrs
Feel free to contact us at support@zohopeople.com in case of any questions.
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
-
-
-
-
-
-
-
-
-
Sticky Posts
Meet the Zoho People experts in your city!
Dear users, We are delighted to invite you to the Zoho People's user community meetup. We are stoked to visit our users in their cities and help them with all things Zoho People. Join us for a day of insightful Zoho sessions, interactions with other
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.