Using Chatter profile picture in Einstein Analytics

Summer is finally here. For many of us this means long walks on the beach, dips in the lake to cool off, tasty ice cream snacks and a new Salesforce release with tons of exciting new enhancements. One of the coolest new features in Einstein Analytics is the ability to use icons on your visualizations. Want to add a little bit of pizzazz to your lenses? Icons are the perfect solution that will bring life into your visualizations. We are here to explain how you can add icons on your lenses in four easy steps. In our example, we are going to show how to add a User’s Chatter profile image as an icon to a lens.

Step 1:

The first step is to add the Chatter profile image field to the dataflow. The field is on the User object, with a label of URL for full-sized Photo and API name of FullPhotoURL; this is a standard field, so you do not have to create a custom one. If you are creating a dataset from scratch, include this field when you extract the User object. If you are adding it to an existing dataflow, add the field to the extract node of User, and to any augments where the User is on the right-hand side. You can even use the new visual dataflow editor, as the picture below indicates. If you are using replication, ensure the FullPhotoURL field is being replicated, then run the dataflow. You are already done with the first step – it was as easy as that.

Step 2:

After your dataflow successfully runs, begin development of a new lens. Let’s imagine you want to include icons on a lens that shows which Sales Reps have closed the most revenue. Set up your measures, groupings, and filters as you normally would. Then, add an additional grouping of the Opportunity Owner’s PhotoURL, as indicated in the picture below.


Then, go to SAQL mode by pressing on the SAQL Mode icon. Your query will look something like this:

q = load “DatasetName”;

q = filter q by ‘IsWon’ == “true”;

q = group q by (‘OwnerId.Name’, ‘OwnerId.FullPhotoUrl’);

q = foreach q generate ‘OwnerId.Name’ as ‘OwnerId.Name’, ‘OwnerId.FullPhotoUrl’ as ‘OwnerId.FullPhotoUrl’, sum(‘Amount’) as ‘sum_Amount’;

q = order q by ‘sum_Amount’ desc;

Step 3:

Your next step is to make two adjustments to the SAQL query. The first adjustment is to remove the FullPhotoUrl on the grouping query. The second adjustment is to add a “first” designation to the PhotoURL on the foreach query. Press on the Run Query button to update the lens.

Your revised query will now look like the below. The highlighted areas signify the adjustments you need to make.

q = load “DatasetName”;

q = filter q by ‘IsWon’ == “true”;

q = group q by ‘OwnerId.Name’; //Remove ‘OwnerId.FullPhotoUrl’

q = foreach q generate ‘OwnerId.Name’ as ‘OwnerId.Name’, first(‘OwnerId.FullPhotoUrl’) as ‘OwnerId.FullPhotoUrl’, sum(‘Amount’) as ‘sum_Amount’;

q = order q by ‘sum_Amount’ desc;

Step 4:

The fourth step is to add the icon to the lens, which can be done in 3 easy clicks. First, click on the Chart Mode icon. Second, press on the Wrench icon to go to Properties. Lastly, under the Y-Axis section, check the Use Icons checkbox, which you will only see if you have completed step 3.

And just like that, you will see icons added to your visualization!

Best Practices and Other Use Cases

Currently, icons only work on bar, column or polar gauge widgets. Another great way to use icons is on a rep quota attainment lens. This is only slightly more difficult than the previous example. Assuming you have quotas loaded as a separate dataset, use a cogroup to join the Salesforce and quota datasets. Your query will look something like this:

q = load “SalesforceDataset”;

a = load “Targets”;

q = filter q by ‘IsWon’ == “true”;

attain = cogroup q by ‘Owner.Name’ left, a by ‘Name’;

attain = foreach attain generate q[‘Owner.Name’] as ‘Name’, (sum(q[‘Amount’]) / sum(a[‘Target’])) * 100 as ‘sum_Attainment’, first(q[‘Owner.FullPhotoUrl’]) as ‘Owner.FullPhotoUrl’;

attain = order attain by ‘sum_Attainment’ desc;

After clicking the Use Icons checkbox, make sure to check the Show as Trellis checkbox under the Trellis section of the widget properties, as shown below.

 

Then, your lens will look like the picture above. Isn’t it beautiful? By following these four easy steps, you have made your dashboards that much more awesome! If you are interested in learning more about other use cases for icons or any other new Summer ’17 feature, please reach out to us at info@springml.com.