I am needing to route a workflow based on the Submission Step in Forms that triggered the Workflow activity.
Thus if I have a Forms process that calls Workflow many different times during a process, I don't want to have to build different workflows to handle those calls. Instead, I want to have a single workflow with branches depending on what Step the form was at that is triggering the action. Currently, the only tokens we have access to that are directly related to the individual submission that triggered the workflow are:
- Submission Comment
- Submission Action
- Submission ID
- Submitter
- Submitter Account
- Submitter Email
- Submitter SID
While I can write the logic to look at the Submission Action, this requires all approval steps calling this workflow to have different Action values. Often the buttons that trigger the process to call workflow all use "Approve" or "Reject", so I cannot count on these to be unique. I am wondering if there is a token I do not know about or a method I've not thought of that will allow me to know the specific Step Name or Step ID relating to the Submission ID that triggered Workflow.
So far what I have come up with is a view against the Forms database that relates the Business Process ID and Submission ID that are passed into Workflow as Input Parameters, with the various tables needed to provide the Step Name and Step ID. However, I am leary as I am unsure if I can count on these tables not changing over time, as well as hate to make an additional SQL query in a Workflow just to get some info that should be readily available already. Here is the query I am using to build my view to get this info:
SELECT B.[process_id] AS BP_ID,A.[submission_id] AS Submission_ID, A.[step_id] AS Step_ID,B.[name] AS Step_Name FROM [LF_Forms].[dbo].[cf_bp_worker_instance_history] AS A LEFT JOIN [LF_Forms].[dbo].[cf_bp_steps] AS B ON A.[step_id]=B.[step_id] AND A.[process_id]=B.[process_id] WHERE A.[submission_id] IS NOT NULL AND B.is_inactive = '0' AND B.is_deleted = '0'
Besides being inefficient to need to query for this info in the first place, has anyone found a better query to find the Step Name and Step ID from forms as it relates to the Submission ID and Business Process ID that triggered a Workflow?