Hi gang. I have a custom workflow where I want to do the following:
Create Thing 1 → Create Thing 2 → Create Thing 3
(where Thing 2 and Thing 3 reference Thing 1)
The wrinkle is that Thing 1 may already exist. So ideally I create Thing 1 “only when” I do a search for thing 1 and the result = 0/empty. In cases where Thing 1 exists, I want to update Thing 1 with potentially newer/more complete data.
The challenge I have is that the “only when” on step 1 may prevent Thing 1 being created, hence the “result of Step 1” is empty, which is a problem for Step 2 and 3 where Things 2 and 3 get created, referencing Thing 1. Ideally, the reference supplied to Step 2 and 3 is EITHER the existing Thing 1, or the newly-created Thing 1.
Where should I be applying the switching logic, and how many workflows do I need to accomplish this? Thanks in advance for any suggestions!
Hi @ThatFizzGuy,
I always face that in wizards that are used for creating and/or editing existing Things. I found that the best way to do this is to have two copies of your workflow;
one that runs only when search for thing: count = 0, which is the create thing workflow
one that runs only when search fr thing: count > 0, which is the edit workflow.
So the condition is on the workflow itself instead of the a step. I think it’s the least complex solution.
Thanks @ankur1 . By inserting a step where I get the value of the Thing 1 I need to use downstream - the newly created one or the updated/existing one - where do I store that mid-workflow? Currently my steps 2 and 3 refer to “the result of step 1.”
Thanks too @hanan1 ! Your way makes sense to me and seems like a simple and straightforward approach. My only hesitation is that it feels redundant if so much of the two flows are the same. That said, I do like simple. Thanks again