Pick a user and see their metrics, accounts on a map, and account details, all on one screen.

Build a user activity report in a screen flow: choose a user, and metrics, a map and a table update on the same screen. For Salesforce admins who build reactive screens.
Hey everyone, today we are diving into Salesforce Flow Builder and exploring how to create a dynamic user activity report using the Avonni Components package. So this is really super helpful for getting quick snapshot of your users' activities, all in one place. Let me show you now what we're building in this video. Here's what we're building. We are
building a user-friendly screen flow component that is easy to navigate. Let me show you how. You can see here this user activity report. This is one screen flow. Here at the top I have this Avonni Header, and then I'm using the Avonni Combobox to display a list of users based on the user object. So let's select the user, and instantly, using reactive screen, I can see multiple components displaying live on the page that display you the user activity report, by having access to important metrics at the top, a map with a list of all the accounts that are colored by industry type, and also here you can see another metric with a number of markers on the map, and then a data table with corresponding account information. And if I'm changing the user on the list, it will automatically update the information on the component itself using reactive screens. So it will automatically update the number of accounts, automatically update the metric and the map. Okay, let me show you now how to build from scratch this screen flow. Let's dive in. Okay, so here we
are. Let's create a new screen flow from scratch. Let's add a first screen element. That's all I need for now. Let's enter an API name and configure the Header and Footer. So if I'm checking back again my example, what I have here at the top, it's a header. So here from the component list I will use the Avonni Header component, drag the component and start building the header. So let's open the Component Builder to get a preview of the component. So let's name it User Report. Now I don't need a caption or subtitle, but feel free to adapt those attributes to your needs. I will check is joined, so to have like this little border, and pull to boundary, so I won't lose any extra space. And then what we can do, we can also add an avatar. So here, Avatar section, icon name, let's select an avatar, and you can also play with the size if needed. I don't need that. That's pretty much done. Perfect. I just need to adjust the style a little bit. Going on the style panel, margin, just add a medium bottom margin. Why? Just to add some extra space between the header and other component that would be just below. Okay, perfect for the first component, the header. What do we have next? Let's get back to our example. Next we have metrics, we have a map. So before dragging a map and a metric, I'd like to drag the combo box. That's really the first step. Why? Because I need to select the user from the list to be able to configure other components. And here for this part I'm using a section, because I have the combo box and on the other column I have another metric component. So let's drag the section
first, create column, configure the column, and now we can drag the combo box to display a list of users. User combo box. Open the Component Builder. Perfect. Label: Select a user. Now I need to connect my Salesforce data with the component. Right now there is nothing inside the combo box, so I need to make it functional, I need to link the data. So here I will go on data source and I will query directly from there the user object. Perfect. Do the mapping. Label, it's full name. We can even add an avatar as well, so let's say contact for the avatar. And now I have all the list of users with an avatar next to it. Perfect. Okay, so I just configured the combo box. Next step, what do we have? Okay, we have metrics at the top, so now I need to configure the three metric
components using a section, and drag inside each column a metric. Let's do it. Section, three columns, and now let's configure the first metric component. Okay, this first metric component will display the open opportunities amount, so I will name it Open Opportunities. Open the Component Builder. Now let's configure the metric. So we just enter label, so Open Opportunities, and now for the value, what will be the value? The value will be equal to the query on the opportunity object, and I want to query the amount field. Why? Because I want to display an amount of open opportunities. And then for aggregate function I will use sum. Perfect. But let's fine-tune the metric. I will just add an avatar right there, change the size, and for the primary metric, right now it's displaying a number, I'd like to display currency. So I will expand primary metric, and for the format style let's select currency. Perfect. That's good, but that's not exactly what I want. Why? Because right now, regarding the metric, I'm displaying the amount of all the opportunities, but it's a user activity report, so I need to filter that by the current user selected from the combo box. So for that I need to put as a filter a formula text variable that will be dynamic, because it will be based on the ID of the user selected from the combo box. So before putting the filter I need to create this text variable. Let's do it. And we will use the exact same formula text variable for other components we want to display regarding features like the map or the data table. So here I'm creating a new
resource. It will be formula. Let's enter a name, owner filter. Data type will be text. Let's now enter the formula, because there is really a special syntax to follow to make this formula working. And basically this formula is our filter formula, so you can think about this formula as what we will put after the WHERE in a SQL query. So for that I need to start with quotation mark and then put the API name of the field I'd like to filter, for example where OwnerId is equal to what. So then I need to continue the logic around the formula, is equal, right there, and now I need to put, you know, apostrophes and then quotation mark, and then here I need to add also ersc. So I will copy paste this formula syntax in the video description below. Feel free to copy paste the syntax and adapt or edit the syntax based on your specific needs, because right now, right there between the on person, I need to insert the resource coming from the user combo box element. So the Avonni Combobox element, I need to select the selected option attribute and select the user ID field. Okay, that's my dynamic formula. So basically it's the WHERE, where OwnerId is equal to the selected value ID coming from the Avonni Combobox. Let's check syntax. That works. Perfect. So now we can go back on the screen element, and for the metric let's open the metric element, and now here under filters I can map that to the formula filter I created. So now this number, it's not displaying here on preview obviously, but when we will run it on Salesforce, this number will be based on the open opportunities amount based on the current user ID. Okay, last step now regarding the metric, let's fine-tune the style of this metric
component. So we'll play with the style panel right there, and let's add some padding first, medium for all the sides, and now let's add a border. Let's select a color, size one pixel, style solid, and let's apply some radius. Let's say 10 pixels, or maybe five, it would be big. Okay, perfect. So just in a few minutes I just configured my first metric component. Done. Next, if we go back on the example again, now I need to display another metric component to display related contacts, and then we will add the last one. It's based on the custom object I have set up on my org, to display the number of current projects owned by this user. So let's do the second metric. Let's drag the metric component again
and let's name it Related Contact. Okay, here's the catch. I already configured the first metric. Why not using the same configuration of the first metric into the second one to save time? So here I'm selecting the first metric, copy. So from there I'm able to copy the configuration of the metric, and then I can open the Component Builder and paste the configuration from the first metric. Why it's useful? Because I will not have to repeat all the same steps to configure the styling or even, you know, the customization of the label or the query. I still need to modify the query, because here I'd like to, and as well as the label, I'd like to when know display related contacts. So it will not be based on the opportunity object, it will be based on the contact object, and then I'd like to query the record, I'd like to query the contact. The aggregate function would be count. Now this time you can use exactly the same filter formula, it's exactly the same owner filter. Perfect. Okay, I just need to change the avatar and also the format of the metric. So avatar, let's use the group one, and then for the primary metric let's select this. Makes sense. Perfect. Okay, now let's do the same thing for the last metric. Again, copy paste the configuration and speed up that creation process. Okay, I just configured the third metric, and really saving a lot of time using the copy and paste features to configure and to copy paste the configuration. That's perfect. Next, what do we have? Let's put a map just below the metrics. So here, so on the flow, let's
drag the Avonni Map right there. Open the Component Builder. It's very easy to configure the map, exactly, almost exactly the same process. I will use Google Map, multiple markers. I don't want to display list view when I'm clicking on the marker, and then for the data source, where the data is coming from my Salesforce, I want to query the account object. Okay, perfect. Again I need to use the exact same formula variable to dynamically filter the information. Okay, for the marker, you can also fine-tune the marker if you'd like to customize the marker style on the map. So for that, right there, type, I will select pin, and then fill color. Yes, I can select one color specifically for the pin, and let's set fill opacity to one. But why not using a formula text variable, but why not using a formula text field that will dynamically change the fill color based on any picklist field from my Salesforce? So let's select mapped, and I already created this field, so it's field color, I think, yes, right there. So now I can see different colors based on what I got from the formula, and then the scale 1.25. I'm sure you're curious to know what the formula looks like. Let me show you the formula syntax I'm using for this field. So on my object I created the field color formula. It's a formula text field type. Let's click on the field, and that's the formula I'm using. It's very straightforward. It's an IF formula. If the picklist field value industry is equal to agriculture, put that color, so it's really the color code. The same for the banking industry, apply this color, and the same for apparel, and then you can really continue the same process. And by mapping this formula text to the attribute on the map, it will dynamically change the color based on what you define on the formula. Perfect. That's almost done. I don't have anything else to configure. Maybe play with the style and set, for the style, the size. I want the map to take all the size on my screen, so I will put a specific height, let's say 500 pixels max height. Perfect. Almost done, almost finished the example. We still need to add this data table and the metric, so let's add the data table.
So let's take the Avonni Data Table. Honestly, it's the same configuration as the map. Open the Component Builder. Again, to speed up my creation process, I will use one of the templates available. I'd like to display account. Let's select this, and it's already pre-filled with specific fields, so it's really helping me, it's helping me to save some time regarding the configuration of the data table. I just need, oh, I'd like to add checkbox column, and again, data source section, query, I just need to put the exact same formula text variable as a filter. Okay, last component we need to add, it's this one you see on the map. It's a metric component. So let's go back on the screen element and let's add the
metric. You're already familiar with the metric, we added three metrics at the top, so you know how it works. Map metric. Okay, for the label let's name it On the Map. Okay, the value, I'd like to query the account object, account ID, count, and filter by, again, the same formula. I want to add maybe an avatar right there, so check, medium, left. That's perfect. So now all we need to do is really fine-tune the style of this metric component. Let's do the style. Okay, so on the style I will just apply some margin at the top. Let's take large, left extra small. Now for the border, I'd like to apply a border color. Okay, size one, or maybe two pixels, style will be solid. Okay, but that's not exactly what I want. I only want to apply a left border, so here on the style I will select this icon, and from there I will be able to select if I want to have something right there or not. Perfect. Let's fine-tune the label. Label size 13 pixels. The same for the value regarding the metric, let's say 16. Okay, and now for the avatar, why not applying a specific color on the avatar? So avatar style, you will find the icon foreground color utility, so here you can select any color you want to apply on the avatar. So that's pretty much done for this metric component displaying the number of locations on the map. Okay, almost done. What we need to do
next, it's really important, it's really to configure the reactivity on components. By that I'm talking about, let's refresh this. So reactivity, it's really to set component visibility based on an action or a specific value selected. For example, right now we don't see the map, we don't see the metrics, we don't see the data table, and if I'm selecting a user, everything will be displayed. So to configure this, I need to apply set component visibility on specific components. Let's do this inside Flow Builder. First one I'd like to set the component visibility on, it's this section with the metric. Set component visibility, and here I will select the combo box user value, and then I will select the attribute value, and is null, false. So it means that this section will only be displayed if the value in the combo box is not null. And we are doing the same for the map. Let's apply this one for the metric, not on the entire section. Why? Because we still want to have the combo box loaded initially. So I just need to set the component visibility on this metric specifically, exactly the same, and finally the data table. Okay, we are done. Now we created this screen flow, this user activity report screen flow, with multiple Avonni components inside. The moment of truth, we need to test the component to see if everything is working as expected. Let's
do it. Okay, let's do a test. Let's select a user. Okay, it's displaying the record, it's displaying all the metrics information. Now let's change the user, let's take Dave. Perfect, it works. I mean, reactive screen is working and all the data is displaying correctly on every component. So that's pretty much what I'd like to show you today with this tutorial about how to create a user activity report. If you have any question, if you're stuck somewhere, let us know in the comment section below. Happy building with the components. Thank you so much for watching.
Create a Text formula resource that reads like the part after WHERE in a query: OwnerId equals the combobox's selected option user ID. Then map that formula in the filters of each metric, map and data table query.
Use Set component visibility on each component or section, with the combobox value is null equals false. They only appear once a user is selected.
Create a formula text field that returns a color code with IF on the Industry value, then in the Avonni Map marker settings set the fill color to Mapped and pick that field.
Browse the whole library, filtered by where it runs and what you want to build.
All video tutorials