...
Change the name of the first condition to read ‘Resource Not Found’, then change the name of the second condition to read ‘Resource Found.’
Step 11:
...
Set 'Resource Not Found' Condition Values
...
Step 11: Edit the ‘Resource Not Found’ condition so that the left value is set to ‘body’ and its property selected as ‘id’ property.
Set the operator for the ‘Resource Not Found’ condition to ‘NULL‘IS NULL.’
Set the ‘Route’ to ‘Create Resource’.
Step 12: Set 'Resource Found' Condition Values
Scroll down to the second Condition set, for 'Resource Found'. Change the route for the ‘Resource Found’ step to ‘Resource Query.’
When done, close the 'Get Resource' Step 13: Close the ‘Get Resource’ step by clicking on the step header.
Step 13: Set Create Resource Step Condition Values
Next, we set the parameters for Step 2, Create resource. Expand blue header, then expand the ‘Create Resource’ step by clicking on its green header. Scroll down to the two required parameters,
Update Required Inputs
Select the "Required Inputs" tab, and find its required parameters - ‘name’ and ‘type’.
Change ‘name’ to be ‘user given’, and as its value put ‘resource-name’, which is the same variable we defined in the previous step. The same value will be used for both parameters.
Change the ‘type’ input to ‘default value,’ and give it a default value of ‘resource’.
Update Conditions
Click on the 'Conditions & Routes' tab. Under the only available Condition, change the Route to the setting Scroll down to the Conditions area and change the Route for the only condition to be the final step, ‘Resource Query.’
Close the ‘Create Resource’ step.
Now that we have set the appropriate conditions and inputs for steps 1 and 2, saving the workflow at this time should automatically resolve any previous "invalid input" errors.
Step 14: Standardize Query Data
Expand the ‘Resource Query’ step. We have two previous steps which can route into this step under different conditions. This is a unification step, to standardize the data coming back. Scroll down to the optional parameters and find
Open the 'Optional Inputs' tab, then find the parameter ‘name.’ As in the previous step, make this parameter ‘user given’ with a variable name of ‘resource-name’.
This will use the same variable we’ve used in previous steps.
Close the ‘Resource Query’ step, and (optionally) save your changes.
Step 15: Format Output
Open Lastly, open the ‘Output’ step and change it so the third field to use 'Resource Query → (object)', so that we are taking the ‘id’ parameter from the ‘Resource Query’ step, and not the ‘Resource Get’ step.
Then, save your changes to the workflow.
Step 16: Execute Workflow - Resource Found Condition
Now that our conditions and paths for both Resource Found and Resource Not Found scenarios have been set, we can execute the Workflow for both scenarios.
First, let's re-execute with a standard 'Resource Found' condition:
At the top of the Workflow page, click 'Execute'.
Execute the workflow with 'TLR' entered for the 'resource-name' input.
In the "Results" section, click on the "Status" tab to view the response. Save and execute the workflow with the resource name ‘TLR’. As before, the returned id will be 1.
Step 17: Execute Workflow - Resource Not Found Condition
Execute the workflow again, but this time with a resource name “nonexistant’'nonexistent’.
As this resource is being created by the system, its id will be the next available.
Step 18: Execute Workflow - Verify Resource Created
Execute the workflow again, again with a resource name ‘nonexistant’‘nonexistent’.
This time the resource does exist, since as we created it on the last execution. Its id is unchanged.
Debug Mode
For additional insight into how Workflow Routing functions, turn on enable Debug Mode by clicking :
Click on the ‘Preferences’ 'Preferences link at the top of the screen near the Workflow options.
Under Edit Workflow preferences, enable 'Debug Mode' ('on' displays as green, with the toggle button to the right).
and enabling it. Running the workflow with Debug Mode on will show all the steps of the workflow and what order they were run, as well as if they were skipped. This .
Executing the Workflow once again with a resource that doesn't exist ("Some New Resource"), then viewing the results tab "Steps (Debug Mode)", shows the condition path taken where the resource was not found and a new one created. This can be very helpful for debugging complex processes.
Additional Information
Continue on to the User Guide for detailed information on working in ACP:
ACP User Guide
Children Display depth 1 page ACP User Guide