|

Open Opportunities/Cases list view in Flow

I had a challenge today at work. I needed to display a list of Open Opportunities and Open Cases for any given Account. The aim was to give an account manager a quick view of what Opportunities and Cases were currently in progress for the Account before they touched base with their key contact.

At first, I thought I could just use a related list, but I only wanted the open opportunities and cases, not the whole lot. I also wanted to only show five (5) records of each so it did not take up too much space on the page. There was no way I could find to filter the related list view and only show a maximum of five records.

I’m not a developer, I think I am allergic to Apex but I’m pretty confident with my Salesforce flow skills. So I started thinking, I could do a get records and only get the open opportunities/cases that are related to this Account. The next problem was how to display them in a compact format and finally how to display a maximum of five records?

That’s where UnofficialSF.com comes to the rescue and Eric Smith’s datatable flow component. This allows me to display the records in a table format and also limit the dislay to the first five records.

Here is the full description of the flow for the Opportunity related list, the case flow is almost identical but uses the case object.

First step is to create a new variable: recordId, of type text with Available for Input checked (so we can pass the account ID into the flow from the account page).

Create a New Variable

Get the Open Opportunities related to the Account (recordId)

Add an Assignment Element to Count how many opportunities were returned

Install the datatable component

Before you can use the datatable component you need to install it (and it’s two dependencies from UnofficialSF.com)

Start the install here: https://unofficialsf.com/datatable-lightning-web-component-for-flow-screens-2/

Next, add a screen element and insert the datatable component

Note: Turn off the header/footer as they are not needed,


Configuring the datatable component:

Follow the settings here, you can experiment with changing them later.


Continue with the settings further down the page:


Return to the middle of the page and click the button Configure Columns:


Select the columns you want:

Change the width settings, keeping the total width to 552 (to fit a 1/3 page right column).


Save and activate the flow.


Edit the Lightning Record Page for the Account

Add a Flow component(1).

Select the new Open Opportunities flow (2), select single column (3).

Pass across the {!Record.Id} from the Account page into the flow (4).

Add a Component Visibility filter to only show the component if there are open Opportunities to display (5).

Save and activate the Lightning Page.

Open an Account record that has Open Opportunities to display the result.


Celebrate!

If you want Open cases as well, create a second flow with most of the same settings but select the case object and case fields.

Similar Posts

One Comment

Leave a Reply