I am working on an utility bar component that displays a form to agents to give feedback (See
feedback utility in the left bottom of the picture). I want to open the utility on case closed event (without agent manually clicking the utility component). Workflow is as below:
Agent close case -> auto open the utility -> Agent answer questions and click submit button -> minimize utility on submit button click
utilityBarAPI provides a method called
openUtility to open the utility. I am having trouble figuring out a way to open the utility when a case is closed.
This is in the salesforce lightning experience.
Options I explored:
Create an Apex trigger that captures
case closedevent and call the
openUtilitymethod in it. But I didn't find a way to make UI changes from backend triggers. I am not sure if this is even supported.
Create a custom button to close a case. When the button is clicked, call the
openUtilitymethod. The problem here is there are multiple ways to close cases like (change status field directly, button click etc). How would I cover all these options?
Create an Apex trigger and send platform event. UI component would listen on the event and open the form. This seems most achievable but there is a problem:
Imagine 2 agents in an org working on cases and both have this component. When
Case 1, the components in both Agent browsers will listen to the event and open the feedback form. But I only want the
Agent 1component to open as he/she closed the case.
Agent 2should not see any changes in his browser/component due to this particular event. Similarly when
Agent 2close a case, only he/she should see the utility bar open up and display the form.
The final solution should work in both Cases page layout and single case layout.
If someone has better ways to solve this problem, I would like to know. Let me know if you need more information. Thank you.
If this use case is not possible with utility bar component, I am open to using other custom components or pop-up modals etc.