You are viewing limited content. For full access, please sign in.

Question

Question

Determining Step ID/Name in Workflow When Started by a Forms Process

asked on August 23, 2018

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?

1 0

Answer

SELECTED ANSWER
replied on August 23, 2018

In your workflow properties, enable "Started by Laserfiche Forms". It will then expose a new Input Parameters token. You should then be able to use a %(Submission Steps#[-1]#) to get the last one as it keeps them in order.

 

There is also a Submission Step IDs token that is hidden that does not show up in the token selector, but shows up in track tokens that I imagine you can use as well.

2 0

Replies

replied on August 23, 2018 Show version history

Like John said, Workflow has access to a couple of tokens for Steps and Step Ids if the "Started by Laserfiche Forms" checkbox is selected under the Workflow properties, you just need to go into the Token Dialog to find them.

Both are multi-valued, but if you retrieve the last index it will give you the most recent completed step (the workflow step itself is not listed).

3 0
replied on August 24, 2018

Thanks, I know about the exposed token "Submission Step IDs" but hadn't thought about grabbing the one at the end.  Great idea!!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.