Restrict Admins from Deleting Records in Zoho Creator | Step-by-Step Guide

Restricting Admin Users from Deleting Records in Zoho Creator

Zoho Creator provides comprehensive permissions for admins, allowing them to perform all edit operations, including deleting records. However, there may be scenarios where you need to restrict certain admin users from deleting records in an application.

This can be achieved by using the On Delete - On Validate workflow with conditions based on the admin's email ID.

Step-by-Step Guide

1. Understanding the Workflow

The On Delete - On Validate workflow allows you to validate conditions before a record is deleted. If the condition is met, you can stop the deletion process using the cancel delete task and display an appropriate alert message to the user.

2. Prerequisites
  • Ensure you know the email IDs of the admins for whom the delete restriction should be applied.
  • Verify that the email ID matches the zoho.loginuserid value of the admin attempting to delete a record.
3. Creating the Workflow
  1. Navigate to the Workflow Section:

    • Go to your Zoho Creator application.
    • Select the relevant form where you want to apply the restriction.
    • Navigate to Workflows and create a new workflow.
  2. Choose the Trigger:

    • Select On Delete - On Validate as the workflow trigger. This ensures the condition is validated before the deletion is processed.
  3. Add the Condition:

    • Add a Deluge script to restrict record deletion based on the admin's email ID. Here’s a sample script:
                  if(zoho.loginuserid == "admin_email@example.com") 
                  {
                          alert "You are not allowed to delete this record.";
                          cancel delete;
                  }
Replace "admin_email@example.com" with the actual email ID of the admin you want to restrict.
4Save the Workflow
  • Save the workflow and test it to ensure it behaves as expected.