Change map marker colors and opacity in a screen flow, and color markers from field values.

Style the markers of the Avonni Map in a screen flow, and color them from your data with formulas. For Salesforce admins who show location data in flows.
Hello and welcome back to this new video tutorial about the Avonni components, and this time I will discuss mainly about the Avonni Map component. And as you can see on the example I have right now, I'm using the Avonni Map to display location of my accounts that have at least one opportunity associated with it. And today's video is about how you can customize the marker, so the pin you can see on the map, how you can customize the look and feel, the color, the size, how you can customize the marker color based on a specific field value. Let me show you that inside Flow Builder. So this is the flow. I will open the screen element, and I already configured the Avonni Map, so I'm selecting the Avonni Map on my example I pre-built. Open the Component Builder, and from there I'm able to see a preview of the map. Just as a recap, what I did, very basic setup. I scroll down to the data source section, do a query to display accounts directly from there, and then what I did is the mapping. So I map the corresponding fields from the object Eon to the corresponding attributes of the map. So on the title I'd like to display the account name. That's why when I'm selecting an item I can see the account name. Description, show me the record description. That's why when I'm selecting this, this is the description field. Now for the location, this is really important to map the correct location fields information, otherwise the map component won't work properly. So for the location, I select to map the billing address field for the street. City, the same, billing, use information from the billing city field. The same for the state, postal code, country. Latitude and longitude, this is optional, but if you'd like to prefill those, that's also possible. So by default this
is the marker. I have this default marker, but based on the use case you'd like to have, you may want to fine-tune the marker. So here, under the type attribute, this is where you can select the map marker type, and you have various options available: default, which is there, circle if you'd like to display the marker as a circle, rectangle, polygon, pin, or custom icon. You can also upload your custom icon to display with a marker using the custom icon. Today I'm going to focus on the pin. Why? Because if I'm selecting the pin, I'm able to fine-tune and customize the pin. So you will see the fill color. So here, let's say you'd like to display things in maybe blue, so now you would see a preview right there on the fill color, and you can set the opacity. This is really important, this is why you will see a difference. Let's say opacity is one, now the fill color is complete. Why? Because zero, it's transparent, and one is completely opaque, and between zero and one you would have more opacity. So stroke color, this is really the line you can see around the fill. So let's say you'd like to make it, I don't know, red. You can make it red, and now you can have it red. So you can really play with those settings, the fill color, stroke color, the same for the opacity if you'd like to make it completely opaque or transparent, and the same for the stroke weight and the scale. So the scale, it's really how big the icon, the marker would be. If I'm selecting a scale of two, my marker will be bigger. If I'm doing 1.5, it would be in between. So that's really nice and easy to customize the marker, and maybe you can play with other colors if you want, let's say this one, and the map is refreshing in preview right there. So now you can see, oh, I'd like to display maybe things in scale using a scale of two. So that's really nice. So that's really how easy it is to customize the map marker by using the prefilled information using the pin. I strongly recommend to use the pin, because it's already there. You can really play with the customization regarding fill color, fill opacity, stroke color, stroke opacity. Now I'd like to really make
something more complex. I want to be able to customize the color based on a specific field value. For example, I want to display different colors based on the industry of the account. Let's say if this account, it's a banking, it belongs to the banking industry, I want it to be in orange, and if it's in the biotechnology industry, I want it to be in green, for example. So for that, what you can do, you can use a formula. So I will show you that right now, how to customize and create a formula. So the first thing you need to do is you need to go on the Object Manager, select the object where you are querying the map component, and from there create a new field. So new field, and this field needs to be a formula field, formula field which will be text, and we can name it field color. So text, next. I already created my formula, so I will just paste the formula. As you can see, it's a pretty, it's not a complex formula. There is a lot of IFs, but basically what I'm saying, it's if the value of the industry is Greer, to apply this color code for the marker, the fill color. If the account industry is banking, apply this color. If account industry is apparel, apply this color, and so on. So you can define the formula where you'd like to fine-tune the color you want to choose, tied to the industry name you'd like to associate with the color. So then create the field. Next, you can make it visible. I don't want to display the field on the page, just on the back end. The same, I want to display the field on the layout. Okay, the field is created. So now let's get back to the
flow. Okay, let's open the flow again. Make sure to refresh the flow to make sure you can see the newly created field, new formula created field, on the flow. So let's open the component, using the Avonni Map, open the Component Builder, and here what we will do. You can see the marker, it's there, that's perfect. Now for the fill color, because we'd like to associate the fill color with the newly created formula, instead of choosing a color manually we can map that to a field. So I would say the field, I think it's the name, it's field color, that's text. And now you can see the icon color, the fill color for the map markers are different based on the value I set up on the formula. So that's really great if you'd like first to customize the look and feel of a map marker, and also if you'd like to fine-tune the color based on a specific formula field you created, so the color would be dynamic based on the field value you set up on the formula. So that's really how you can customize, fully customize the map marker by setting up the style and also some specific attributes you'd like to differentiate with a field value. And you can do exactly the same process if you'd like to map an attribute with different values to an existing formula field, so feel free to repeat this process to more fields. So that's how mainly you can fully customize the map marker and do anything you want with it regarding fields information displayed on the map. Thank you so much. Let me know if you have any question in the comment section below. Thank you, bye-bye.
In the Avonni Map, set Type to Pin, then set Fill Color, Fill Opacity, Stroke Color, Stroke Opacity, Stroke Weight and Scale in the Component Builder.
Create a Text formula field on the queried object that returns a color code for each value, then map the marker Fill Color to that field in the Avonni Map.
The location fields: street, city, state, postal code and country, mapped here to the billing address fields. Latitude and longitude are optional.
Browse the whole library, filtered by where it runs and what you want to build.
All video tutorials