From Ruchi Sharma: Setup a Topic Hierarchy
Salesforce Scheduler provides a component to display and select a work type group.
By default, this component display all the work type group records, in Spring â22 this component is getting the capability to filter work type group records based on specified Ids.
You can check the component documentation here.
Work Type Group Hierarchy
Imagine you are a bank manager and a user is scheduling an appointment with the bank.
While scheduling an appointment you want the user to select hierarchical work type groups to know about the appointment context.
Example – Suppose the first level work type group hierarchy consists of personal banking, wealth management, etc. Based on user selection we will display the next level hierarchy. If the user selects personal banking then the second level work type group hierarchy consists of checking saving account, loan management, etc.
You can easily display work type group hierarchy in salesforce scheduler flows with clicks, not code! đ
Please check below 3 level hierarchy demonstration
Letâs look at how it is done,
Configuration is the same for Outbound, Inbound, and Guest flows, illustrating for Outbound Flow.
- Create a self lookup in the Work Type Group object.
This will store the parent work type group record id. - For this feature, we will be using the âFilter by work type group Idsâ input configuration of the âSelect Work Type Groupsâ component.
- Add a new Assignment element called âSet filter by work type group ids as nullâ, after Set Topic Stage.
And the arrows pointing to the topic screen will now point to this element.
Assignment element :
In this element, we are setting the âFilterByWorkTypeGroupIdsâ variable as null.
OOTB flow :
After change
- After the assignment element adds a âGet Recordsâ element to fetch the work type group records.
Initially, we are assuming variable workTypeGroupId is null.
Work_Type_Group__c is the self lookup field.
- Loop over fetched work type group records and append the work type group Ids in the âFilterByWorkTypeGroupIdsâ variable.
- After the loop element adds a decision element to check FilterByWorkTypeGroupIds is not null (next-level hierarchy exist) or workTypeGroupId is null (If itâs loading for the first time).
- If the next level hierarchy exists then add an assignment element to clear the previously selected work type group and connect this element to âTopic Screenâ.
Else redirect to âSet Appointment Stageâ. - Optionally to display the selected hierarchy on top of the work type group selection screen, add a âGet Recordsâ element to fetch the selected work type group record.
Redirect the topic screen to this element.
Then add an assignment element and create a work type group collection variable to add the work type group record. - Finally, connect the above assignment element to the assignment element that we have created in step 3.
- To show the selected hierarchy, drag and drop the âDisplayWorkTypeGroupHierarchyâ custom component above the âSelect Work Type Groupsâ component in the topic screen.
And pass the work type group collection variable as input to this component that we have created in step 8. (optional)
That’s it! Activate and run the flow.
All the code is bundled at https://github.com/ruchi2994/workTypeGroupHierarchy. It contains the above component and updated flow.