Also have a question of workflows triggering on a ...
# general
n
Also have a question of workflows triggering on a CSV upload. I have two workflows that either one is kicked off if a field is blank or populated. When running a CSV upload and having that field populated both kicks off and seems to ignore the condition. When I disable the workflow that kicks off when field is blank, and run the CSV upload everything works as expected. I just don't understand why when having both workflows enabled and looking at the specific field for the condition why both are being triggered. My only thought process is the way the record is being created via the CSV. Does the trigger type need to change?
m
You can specify CSV import in the context of workflow execution or action execution. Is that selected?
n
It is, we still upload two different types of bills, one that should trigger one workflow and another that should trigger the other. The route I took was to trigger the workflow after record submit action.
m
I wouldn't restrict the workflow initiation by trigger Leave all triggers available but set your condition based on your field Although I don't understand your criteria Are you saying WF1 triggers if field is blank WF2 is triggered if field is NOT blank?
Or alternatively make 2 checkboxes If checkbox1 is true then use wf1 Checkbox2 is true then use wf2 Then set the proper checkbox on your Csv import. Would that work?
n
Yes, one triggers if it is blank and the other one if not blank.
The thing is when uploading the bill via csv, the condition statements both trigger, even though for this example the purchase request type is not empty.
m
What do the Wf logs say?
n
On the bill record itself?
m
Yes
n
It shows it both of the workflows being triggered. It enters and exits the one that triggers when blank, and then stays in the one that triggers when it is populated. I can recreate one real quick in SB to show what exactly it looks like.
Initiation is the first state, approved is the last state.
m
What happens if you upload a bill with the field blank?
Is only the blank Wf initiated
Also does it work correctly when entering a bill manually in the UI
n
Okay, bill created via UI with both workflows active and purchase request type = blank. Works as excepted.
m
Ok this is making sense. Kind of I think the issue is because in the CSV import you aren't setting specifically NULL as the field value But instead the row value in the Csv is blank which essentially is like “skipping” that field instead of intentionally setting a value or NULL value I know this doesn't seem like it should make a difference but I think this may be the cause Can you attempt your CSV import again but instead can you hardcode in the mapping a null value for purchase request type. You know where you click the pencil icon and set a hardcoded value instead of column mapping?
n
And then only having the =blank workflow enabled I get this result (expected).
Yep can do.
Wait... still a bit confused. It appears that just doing where purchase type = blank works. It is when I am trying to upload a csv where all of them are not blank.
m
You can try that setting in the advanced options that overwrites null values?
Then anything blank in your file will be intentionally set to NULL instead of ignored
n
I mean I am already hard coding in the purchase request type.
Also enabling "Overwrite Missing Fields" did nothing. Still triggered both workflows. It just seems like doing a CSV upload sets the "Purchase Order Type" to blank (null) right before populating it with data, and that is causing both to trigger.
m
Ok bummer. I thought that might do the trick but I guess not I can think of a few ways to do this but not sure what fits with your business process 1. Make your workflows into scheduled workflows running every 30 min. Then you saved search criteria uses the BLANK vs. not BLANK criteria to initiate the proper WF. (Scheduled workflows can initiate on a schedule but then act as event based once initiated 2. Create 2 import templates 1 for blank request type 1 for not blank 3. Create 1 workflow with no initiation criteria but have it transition to two different “branches” based on purchase request type 4. create the 2 checkboxes mentioned above and add those as columns in your csv file
n
And what is the downside of just trigger the workflow on "After Record Submit", with the event type of "Create"?
m
Isn't the downside that it doesn't work correctly when using the Csv import?
n
Nope, changing the trigger type to that allowed both types of CSV uploads to process normally. Sorry if I wasn't clear on one of my first messages.
m
So to confirm if you set the trigger type to after submit and set it to on create everything works correctly?
n
As far as I can tell on the uploads and doing things manually.
m
Oh man. Sorry I misread some of your messages I thought you were saying you still had an issue even when using After submit
But you were saying after submit fixed the issue
Yes after submit makes sense here as you need the system to evaluate the field value after the record is submitted to the database If you use no trigger or entry then it will try to evaluate the condition as soon as the record is being created which ALWAYS starts with a blank value until you set it and save So yes after submit (or before submit) is how you would solve this
n
Thank you for helping me!
m
Sorry for the wild goose chase
n
Nope, it was good for testing and understanding better what is happening.