The utility bar in Lightning is a special page that helps your users quickly use common tools on desktop. It shows up as a fixed footer, letting users open tools in docked panels. Some tools can also pop out and open in a new browser window.
There are many ready to use utilities that Salesforce provides. For instance, Recent Items, List View, and Omni-Channel are some of the available utility items. On the other hand, you can add your own custom components as well.
One of the standard utility items available is Flow. This allows you to add your active screen flows to the utility bar. While it's a great method for launching screen flows in Salesforce, there is a significant limitation. It is not possible to pass the current record's Id to a flow in the utility bar.
As you can see, there is no option to pass the record Id. Moreover, unlike action buttons, it doesn't automatically pass the Id to an input variable called recordId.
How to Pass the Record Id to a Flow in the Utility Bar
There is no standard way to pass the current record's Id to a flow in the utility bar. However, it is possible to do it using a custom action.
In this post, we will use the GetURL action in order to obtain the URL. Once you have the URL, it is possible to parse the obtained value within the flow and extract the record Id.
1- Install the GetURL action from the link above.
2- Add a new action to your flow and search for GetURL, this is the name of the component that you installed.
You can use the component's output value in order to obtain the current URL.
3- Create a new formula resource in order to extract the record Id from the URL.
RIGHT(
LEFT({!URL},
FIND('/view', {!URL})-1), 18)
4- Now that you have the record Id, you can check the object name and build your flow accordingly. If you are planning to use custom objects, read this post to learn how to get the object name from the record Id.
For instance, this is a flow that creates a feedback (custom object) record from Account, Contact, and Case records. It has a decision to check the object name. Then it gets the current record according to the result of the decision. As you can see, it has completely different paths for each object. If you run the flow from a different object or page, it creates a generic feedback record.
Demo
Let's see this flow in action.
As you can see, this flow creates a feedback record related to the current record. Pay attention that it displays the current record's name on the screen. This can be a little proof that it really gets the current record.
When you switch to another record, you will want to run the flow again. In order to do this, add an option to end the flow interview. For instance, the Cancel button ends the flow. It is a custom flow button from UnofficialSF and the flow ends when you click it (it goes out from the decision element).
To sum up, using a custom action, it is possible to pass record Id to a flow in the utility bar. This is a great and fast way to run screen flows for any record in the system.
Does this work in service console?
Yes, it should work in service console too.
Hello Yumi -
When attempting to create the formula I get the following error: The "URL" resource doesn't exist in this flow.
Am I supposed to be something on the url field on the GetURL component for input value?
Hi Angel,
You are right, URL is the output of the action. You can create a new text variable called URL, store the output of the action, then create this formula.
Hi Yumi
I see on the utility page they have added a recordid var in the settings - but I was not able to pass it into the var . do you have any suggestions?
tried putting there {!record.id}
Right, it is not supported at the moment. You can pass only hardcoded values.