Setting a Process’s State and State ReasonLast Updated: 07/19/2016 Introduced in Verision: 2.0 |
Process folders can be assigned a state and state reason by using the Set State and State Reason component. It can be found in the Toolbox tab, under the category Flow Management > Data.
Example
In this example flow, we will set up a process folder to hold data for a Customer’s financing application. This example assumes that our flow’s forms have already been designed. At each stage of the application process, the process’s state will change, from Started to Submitted, and then to either Approved or Rejected.
We will begin in the folder for our Customer custom folder extension: System > Common Data Elements > Folder Behavior Actions > UserType.CustomerFolderBehavior.
In the resulting New Flow pop-up, we will call our flow “Apply for Financing” and click OK to open it in the Flow Designer.
First, we will place the Setup Process Folder component in our flow. We’ll find it in the All Steps [Catalog] > Flow Management > Data category of the Flow Designer’s startup window. Select it and click Add to add it to the workspace.
In the Properties tab, we will set Parent Folder to FlowInput, Make Unique to Number, and Flow Prefix to “FINANCING”.
In the Mapping Editor, we will map FolderId to Parent Folder Id, define Folder Name as “Financing Application”, and set the Anticipated Flow Time to 1 hour.
Next, we will define our process’s state as Started. We will find the Set State and State Reason component in the Toolbox tab, under the category Flow Management > Data.
In the Mapping Editor, we will define state as “Started”.
We will give stateReason a Mapping Type of Text Merge Plain and define it as “Started by [Flow Data.CurrentUserEmail].”
Next, we will place the form that will accept applicant details. We’ll find it in the Toolbox tab, under the category Forms [Interaction] > [Root Folder] > Designer Entities.
On submission, we want to change our process’s state to “Submitted”, so we will place another Set State and State Reason component.
In the Mapping Editor, we will define state as “Submitted”.
We will give stateReason a Mapping Type of Text Merge Plain and define it as “Submitted by [Flow Data.CurrentUserEmail].”
Next, we will place the form that will display applicant details and give the user the option to Approve or Reject the application. We’ll find it in the Toolbox tab, under the category Forms [Interaction] > [Root Folder] > Designer Entities.
In the Mapping Editor, we will map the Application form’s outputs to our Approval form’s inputs.
On approval, we would like to set the process’s state to Approved, so we will place another Set State and State Reason component at the end of the Approve outcome.
In the Mapping Editor, we will define state as “Approved”.
We will give stateReason a Mapping Type of Text Merge Plain and define it as “Approved by [Flow Data.CurrentUserEmail].”
On rejection, we would like to set the process’s state to Rejected, so we will place another Set State and State Reason component at the end of the Reject outcome.
In the Mapping Editor, we will define state as “Rejected”.
We will give stateReason a Mapping Type of Text Merge Plain and define it as “Approved by [Flow Data.CurrentUserEmail]. Comments: [Comments]”
After connecting the last of our outcomes, the flow will be completed. We will save it and close the Flow Designer.
To test our flow, we will go to a Customer folder and select the action Apply for Financing.
In the resulting pop-up, we will define the parameters of our application and click Done.
Back in our Customer folder, we will see that a process folder has been created: Financing Application 1. When we click to open the folder, we will be taken to the Process Data View of our application. In this view, we will see the comprehensive record of our process’s history and its current state. We will see that its current state is “Submitted”.
In the Applicant Details form of our flow, we will fill in the Comments field and click the Reject button.
Back in the Process Data View, we will see that our process is 100% completed with a final state of “Rejected”.