FAQ
How can we help?
Full Site Search

How to pop up a warning but still allow saves when users input duplicate values?

If you wish to prevent users from creating duplicated entries, you can set up the "Unique" attribute.

Sometimes, we would like the system to pop up a warning but still allow saves when users input duplicate values. For example, we want to prevent users from creating duplicated entries for the same customer in the "Contacts" sheet. However, there are cases where clients might have the same names. Hence, we would like to be notified before we save the entry and check if the entry is duplicated.

You may follow the steps below:

Step 1: Open the Ragic workflow editor.

Right-click on any of the Tabs and select Global JavaScript Workflow.

Step 2: Switch edit page to "Global Workflow" and paste the codes.

function checkIfUniqueFieldValue(fieldId, path){
   var value = param.getNewValue(fieldId);
   var query = db.getAPIQuery(path);
   query.addFilter(fieldId,"=",value);
   var result = query.getAPIResultList();
   if(result.length > 1){
   response.setMessage("The "+ value +" already exists. Please check for duplicates.");
}
}

Step 3. Switch edit page to "Post-Workflow" of the sheet you want to check for duplicates.

Let's say the URL link of the sheet you want to do check for duplicates is "https://www.ragic.com/accountname/tabname/1" and field ID is 1000038.

Then, add this line to the Post-workflow:

checkIfUniqueFieldValue(1000038, "/tabname/1");

Don't forget to save your changes before exit the workflow editor.

Top of Page

    Start Ragic for Free

    Sign up with Google