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:
Right-click on any of the Tabs and select Global JavaScript Workflow.
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."); } }
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.