Duplication prevention at its core is a 3 step process involving a search action, a conditional action and a create action.
- Search Object Action: The search action finds existing records based on input parameters usually from the trigger. In some applications (e.g. Salesforce), you may find multiple input parameters that you can use as the search criteria. In others, you might only be given one field to do the search. .
- Conditional Action: The conditional action checks if the record ID is not present. If the record ID is not present, that means that the record was not found from Step 1.
- Create Object Action: If the condition in step 2 is met (e.g. the record ID was not present), you can safely create the record in a nested step.
In the example above, there is an email record coming in from the trigger. From here, we use that email to search for contacts in Salesforce. If the search did not yield any results, we know that this email has not been registered in Salesforce. If it did find a contact, it means that the contact already exists in Salesforce. Therefore, from the conditional action, it will only create a new contact in Salesforce provided it does not exist yet.
You are free to add additional steps to this process as your logic dictates, as long as you keep to this core principal of running a search and using conditional actions. For example, you may choose to add a step, if contact already exists, then do something else, like update that contact.
For Salesforce, there is an action called "Create or update object" that allows you to do all this in one step, where if an object does not exist it is created, but if it does exist, the object is updated. Find out more here.
*If you find missing actions for a particular application that you would like to prevent duplicate record creation, please post a request on our forums here.
Have a suggestion on how to use Workato better? Post them on our forums here!