Overview
Sometimes business processes are more complicated and have significant permutations that are not easily managed with out-of-the-box Business Process Flow (BPF) functionality. In this article we will demonstrate how you can use North52 Decision Tables to create rule dependent task checklists for each BPF stage on the Case entities Business Process Flow (BPF) called Phone to Case.
The tasks are created at each BPF stage change and checked to ensure any predecessor tasks are completed first and all tasks for a given stage must completed before the user can move to the next stage.
https://www.youtube.com/watch?v=3cjMpE1_g10
North52 Decision Suite
The North52 Decision Suite solution works like this:
- A Save - Perform Action Formula is set up on the Phone to Case Process entity which:
- Executes a Decision Table when the Active Stage field changes
- Depending on the selected Stage, Task records are created and associated with the Case
- Executes a Decision Table when the Active Stage field changes
- A Validation Formula on the Phone to Case Process entity checks for open Tasks associated with the Case and the current BPF stage
- If there are open Tasks a Business Process Error is shown to the end-user
- A Save - Perform Action Formula on the Task entity which:
- Checks if the Task has predecessor and if the preceding Task is not Completed
- If the predecessor Task is not Completed then a Business Process Error is shown to the end-user
- Changes the Status
- Checks if the Task has predecessor and if the preceding Task is not Completed
- A Client-Side Formula on the Case entity refreshes the Checklist subgrid when the BPF stage changes
Set up Task Entity, Case Entity and Formulas
Task Entity
We need to add new fields and create a new view on the Task entity.
New Fields
- Create a Decimal field named Sort Order
- Create a Single Line of Text field named BPF Stage
- Create a Lookup field named Predecessor with a Target Record Type of Task
- Create an Option Set field named Change Status (this is used to change the Status Reason via a Formula as the out of the box Status Reason cannot be edited in a Editable Grid) and add the following options:
- Open (set this as the Default Value)
- In Progress
- Completed
- Publish changes
Note: you could add these fields to the Task form too, however the fields are not designed for user input on the form so it is not necessary
New View
- Create a new view called Checklist Items
- Add the Subject (300px), Change Status (125px), and Sort Order columns
- Configure the sort order so that the Sort Order column is selected in Ascending Order
- Publish changes
- We don't really want the Sort Order column displayed, however we want the sort to remain so we can use the View Designer XrmToolBox plugin to modify the view:
Case Entity
We need to add a subgrid showing the Checklist Items view from the previous step on the Case Entity form:
- Open a Case form (we saved a copy of the main Case form and renamed it Case - Checklist Items)
- Insert a new One Column Section and position it at the top of the middle column
- Label the section Checklist and check the option to show the label
- Add a Sub-Grid to the Checklist section
- Set the Name to TaskChecklist
- Set the Label to Task Checklist
- Under the Data Source section set:
- Records = Only Related Records
- Entity = Tasks (Regarding)
- Default View = Checklist Items
- Uncheck Display Chart Selection
- On the Formatting tab, set the Number of Rows to 10
- On the Controls tab add the Editable Grid control
- Disable the Group by Column
- Click OK
- Save and Publish the form
Formula - Create Checklist Task Items
This Decision Table formula will provide the logic which creates the Tasks at each stage of the BPF.
- Create a new formula, setting the following values in the Formula Guide:
- Source Entity set to Phone to Case Process
- Set Formula Type to Save - Perform Action
- Select the Decision Table editor
- Change the Name of the formula to Phone to Case Process - Save - Create Checklist Items
- Set Event to Create & Update
- Expand Source & Target
- For Source Property select Active Stage
- Click Save
Set up Conditions
- Select cell A2
- Select the Source tab
- Expand Related (N:1)
- Expand processstage (activestageid)
- Expand (Attributes)
- Select Process Stage Name
- Select cell A4
- Enter the text 'Identify' including the quotes (this is the Stage Name and can be found by opening the BPF in the BPF editor)
- Select cell B2
- Right-click and select Insert > Insert Condition
- From the Source tab
- Expand Related (N:1)
- Expand incident (incidentid)
- Expand (Attributes)
- Select Case Type {Value}
- Select cell B4
- Expand Case Type {Value}
- Select Problem
- Click Save
Set up Actions (create Task records)
- Right-click anywhere on the Decision Table and select Set Sheet Options > Use Create Record
- Right-click again and select Hit Policy then uncheck Exit this Decision Table on First Match (this means all rows in the Decision Table will be processed even if a condition match occurs on a previous row)
- Highlight colums D to G, right-click and select Insert > Insert Action
- Select the Explore tab
- Enter task in the Search data model input box and press enter
- Expand Task
- Select cell C2
- Select Subject from the Task attributes
- Select cell C4
- Enter the text 'Validate the problem'
- Select cell D2
- Select Sort Order from the Task attributes
- Select cell C4
- Enter the number 1
- Select cell E2
- Select BPF Stage from the Task attributes
- Select cell E4
- Enter the text 'Identify'
- Select cell F2
- Select Predecessor (Value) from the Task attributes
- Select cell G2
- Select Regarding (Value) from the Task attributes
- Select cell G4
- Enter the text 'incident



