We’re working on adding a CSV upload feature for a CRM app. Users can upload their own custom sheet and map fields to match to the database.
Data could be uploaded in a format such as
First Name, Last Name, Email 1, Email 2, Phone 1, Phone 2, Company, Property Address
I want to check that if the data doesn’t exist (i.e. for a Contact), then the record should be created.
It’ll be easiest to just check one set of conditions, i.e. if First, Last Name, & Email don’t exist in a record, then create new record.
But there may be situations where users want to use just the First & Last Name to check for duplicates… or maybe they want to use 5 fields to check.
I don’t know if it’s overkill to think about this, but I’m curious to know if it’s possible to dynamically set constraints based on data coming elsewhere in the app. I imagine this solution would be a “Make Changes to a Thing” workflow with “only when… (if any values (the checkmarks below) are true in the appropriate column, then use those fields as a constraint”
It’s a bit late so not sure I explained it well, so feel free to ask if it doesn’t make sense.
The image below is saying that all the fields that are checked are used together to check for duplicates.
If I’m understanding right, what I would do is whenever the user clicks upload (or whatever action they take after this screen you show), I would set a state to an element that houses each of the constraints they want to use. Let’s just use first name, last name, and email as an example.
If the user clicks upload, then it sets the state of say, this table, to have one state field for each constraint. Pass all these to whatever workflow you’re uploading the data and then plug in each possible field they could use as a constraint. Then check the box ignore empty constraints. This way it will only use the constraints you passed from the state of the table (aka the ones the users selected).
No idea if this makes sense, let me know if it doesn’t and happy to explain further as well. If you want, taking a peek at your current workflow after this screen might help give specific advice on where to place what.
So would this be the correct process? My example uses just First Name as a field used to duplicate check. I would create new actions to create States for each field and set a conditional “only set state when Field XYZ contains a True value in the 3 columns (Contacts, Companies, Properties)… or use an OR operator”. If I had 10 fields a user can check to, there would need ot be 10 state actions.
So in the screenshots, I would need to pass the state between the API workflows as a parameter? If the First Name state is True for contacts and state name = check_Contacts (it could be check_Companies or check_Properties), that can end up in the final action that checks for duplicates only if the state = check_Contacts
Not sure if this is the most efficient way to be scheduling all these workflows or if this is the correct process.
The last screenshot shows the delete_duplicate_contact workflow. A user wouldn’t check duplicate First name agaisnt a property, so I assume when delete_duplicate_property is created, then you only need to include those fields someone may use (so First Name is excluded).
I also am not too sure how you would set the conditional in the last step to constrain the “only when…” when you could have any number of states set to check_Contacts for a number of fields (that would all need to be True for the workflow to check duplicates).