Location Based Check in/out Using Geo-fencing | Zoho Creator Help

Location Based Check in/out Using Geo-fencing

Requirement

Restrict access to a Zoho Creator form when it is accessed outside the specified geographical boundary, using geo-fencing.

Use Case

Consider an organization which uses Zoho Creator application for employee management. This application includes a form to track check-in and check-out activities. By enabling Geo-fencing within this form, it ensures that only employees physically located within the designated office area can check-in, effectively preventing any unauthorized or fraudulent entries.

See how it works

Steps to Follow

  1. Create a from with the following details to collect the Check In and Check Out data of the employees.

    Form

    Form Link Name

    Field Type

    Field Name

    Field Link Name

     

     

     

    Check In/Out

     

     

     

    Check_In_Out

    Drop Down

    Check In/Out

    • Check In

    • Check Out

    Check_In_Out

    Email

    Email

    Email

    Date_Time

    Check In Time

    Check_In_Time

    Date_Time

    Check Out Time

    Check_Out_Time

    Drop Down

    Status

    • Checked In

    • Checked Out

    Status

  2. Navigate to the form properties by clicking on the settings icon () in the top-right corner.

  3. Rename the Submit button to Confirm and hide the Reset button by clicking the Click to hide () icon.

  4. Enable Geo-fencing in the form properties. A pop-up will be shown to configure geo-fencing.

  5. Select the desired location on the map or search for the location by typing the address in the Address field.

  6. Adjust the radius according to your preference. In this example, we have set it to 1 mile.

  7. Customize the default error message for geo-fencing to align with your preferences, conveying to users attempting to access the form outside the geo-fenced region.

  8. Create a page named Employee Check_In/Out.
  9. Embed the Check In/Out form into the page and customize the remaining page depending on your preference. Here, we have additionally embedded the Check In/Out Report.

  10. Create a workflow to execute on validation of Check In/Out form submission to auto capture the check in and check out time of the employee and name the workflow Auto Capture Time.

  11. Add the following code in the Deluge editor.
    1. //Fetch the attendance record of the logged in user for the day.
    2. var = Check_In_Out[Check_In_Time == today && Email == zoho.loginuserid];
    3. If there are no matching records when the user checks in, autofill the field with the current check in time, user email, status as "Checked In," and reset the Check In/Out field.
    4. if(var.count() == 0 && Check_In_Out == "Check In")
    5. {
    6. input.Check_In_Time = zoho.currenttime;
    7. input.Email = zoho.loginuserid;
    8. input.Status = "Checked In";
    9. input.Check_In_Out = "";
    10. }
    11. //If the checked in user tries to check in again on same day, show alert message and cancel form submission.
    12. else if(var.count() > 0 && var.Status == "Checked In" && Check_In_Out == "Check In")
    13. {
    14. alert "You've already checked in";
    15. cancel submit;
    16. }
    17. //If the user checks out, update the existing record with the current check-out time, user email, status as "Checked Out," and reset the Check In/Out field.
    18. else if(var.count() > 0 && var.Status == "Checked In" && Check_In_Out == "Check Out")
    19. {
    20. var.Check_Out_Time=zoho.currenttime;
    21. var.Email=zoho.loginuserid;
    22. var.Status="Checked Out";
    23. var.Check_In_Out="";
    24. }
    25. //If the checked out user tries to check in again in the same day, update the status to "Checked In" and clear the Check Out Time field.
    26. else if(var.count() > 0 && var.Status == "Checked Out" && Check_In_Out == "Check In")
    27. {
    28. var.Status="Checked In";
    29. var.Check_Out_Time=null;
    30. }
    31. //If the checked out user tries to check out again on same day, show alert message and cancel form submission.
    32. else if(var.count() > 0 && var.Status == "Checked Out" && Check_In_Out == "Check Out")
    33. {
    34. alert "You've already checked out";
    35. cancel submit;
    36. }
  12. Create another workflow to execute on the successful submission of Check In/Out form and name the workflow as Preventing Empty Record Entry. This workflow safeguards against the creation of multiple records when users attempt to check in or out.

  13. Add the following code in the Deluge editor.
    1. //If the Check In/Out field has not been reset in the previous "Auto Capture Time" workflow, delete the corresponding record.
    2. if(input.Check_In_Out == "Check Out" || Check_In_Out == "Check In")
    3. {
    4.  delete from Check_In_Out[ID == input.ID];
    5. }
  14. Create another workflow to hide the auto populated Check In Time, Check Out Time, Email, and Status fields of the Check In/Out form and name the workflow as Hide Fields.

  15. On the subsequent page, click Add New Action, choose Hide fields, set this action to run always, and select the Check In Time, Check Out Time, Email, and Status fields.

See How It Works


  1. Geo-fencing