Notice how Check Name state holds our original input and adds its result inside $ .checks.name and how Check Address takes that output as input and add its own address check result inside $ .checks.address. That’s the power of ResultPath.
At this point, we have a successful workflow, but the workflow is still missing some important logic. Our workflow goes directly from Check Address to Approve Application. What we want is to automatically approve an application only if both the name and address are not flagged, and if the application is flagged we will queue the application for the controller to do the re-check.
We will incorporate the step of waiting for a controller response on flagged applications. But before that, we need to learn how to check the status of the working workflow and execute some branching logic based on the checks we define. To do this, we will need to add a new type of state to our state machine called Choice state.