Automated Checkout

Automated Checkout

Hi Team,

I’m trying to create an automated checkout function in Zoho People. My requirement is that if an employee forgets to check out, the system should automatically check them out after 10 hours. However, I'm encountering an error while updating the records, and I'm not sure how to resolve it. I've attached the error details for your reference.

{"response":{"message":"Error occurred","uri":"/api/forms/json/P_AttendanceForm/updateRecord","errors":{"code":7204,"message":"Wrong datatype for the Parameter Input"},"status":1}}

This is the code that I have used in the Custom Function.


response3 = zoho.people.getRecords("P_AttendanceForm",0,0,searchList,"zpeople");
filteredRecords = List();
for each  record in response3
{
checkinTime = record.get("FromTime").toTime();
timeDiff = (zoho.currenttime - checkinTime);
hoursWorked = timeDiff / 3600000;
if(hoursWorked >= 10)
{
filteredRecords.add(record);
}
}


for each  record in filteredRecords
{
try 
{
checkoutTime = record.get("FromTime").addHour(10).toString("dd-MMM-yyyy HH:mm:ss");
emp_id = record.get("EmployeeID");
param_map = Map();
param_map.put("ToTime",checkoutTime);
response = zoho.people.update("P_AttendanceForm",param_map,"zpeople");
if(response.get("code") == "SUCCESS")
{
info "Updated checkout for ID " + record.get("ID") + " to " + checkoutTime.toString("dd-MMM-yyyy HH:mm:ss");
}
else
{
info "Failed to update ID " + record.get("ID") + ": " + response.get("message");
}
}
catch (e)
{
info "Error processing ID " + record.get("ID") + ": " + e;
}
}
info response;


Please let me know how to proceed
    • Sticky Posts

    • How to Add Users to your Organization in ZohoMail?

      A better clarity so you can create other users to start using Zoho Mail. You can directly Add Users from the Control Panel to your Organization. You can invite users with the existing email address. If the person (user) already uses ZohoCRM, then you can import users from Zoho CRM. You can also import them using a .csv file. (if you are planning to add them in Bulk)  In this topic, We will be discussing on how to Add and Invite users only.  The Import options are self explanatory. ____________________________________________________________________________________________________________