🚩Warning! Unhappy customer ahead…🚩

The problem

Let’s start with a little story…

Winn Ing – EMEA Sales Team Member

“In the past 12 months I sold some widgets to ABC Technology. The sale went well and I’m pretty sure they like me 😃

I venture that I could probably sell them some more widgets. I get on the phone, set up a meeting and rock up feeling confident, only to be met with a room full of stony faces.

Something is very amiss here. ABC Technology inform me that since they purchased their widgets they have had to open tons of support requests and they currently have an escalated case open! I wish the floor would swallow me up.

Why did no one tell me about these issues?!?!”

Chris Lightning – Salesforce Administrator 

“In truth, there should have been no need to inform Winn about the issues with her customer. The cases are logged on Salesforce so the information was available to her the whole time.

It would be great if I had an easy way to highlighting service issues to sales users…somewhere they actually look in Salesforce?!”

So where do sales users spend a lot of time in Salesforce? Opportunities! Wouldn’t it be useful if we could somehow display relevant service information like the number of open cases or escalated cases, directly on opportunities? That way, our sales team would be pre-warned of potential issues before they sit down with a client!
angry customers


👉 Install Declarative Lookup Rollup Summaries (DLRS) from GitHub

👉 Read Getting Started With DLRS before starting this tutorial

👉 Install Graphics Pack by Salesforce Labs from the App Exchange

👉 Part of the solution is to create an image formula that displays a picture warning users there are open escalated cases. After installing Graphics Pack, choose an image and follow the Graphics Pack instructions to find the document ID which will be used in our formula.

The solution

We want to be able to see service information (cases) for an account on any opportunity. We can achieve this by first using DLRS to roll up the values from cases to the account, and next using formula fields to bring these values over to any related opportunities.

We do not have the option to use the standard ‘Rollup’ field type on the account as we can only rollup opportunities and entitlements in this way.

Once we have our information ready, we can then display it somewhere prominent on the opportunity Lightning record page and use component attributes to ensure it only displays when relevant.

It sure sounds like a lot of work but I promise you can achieve all this within an hour or two.

  1. Make sure you’ve completed the prerequisites above!
  2. Navigate to Setup > Object Manager > {Accounts} > Fields & Relationships
  3. Create 3 new fields on the Account object – make them visible to all profiles and display on the Account page layout:
    • Data Type = Number
    • Field Label = Open Escalated Cases
    • Length = 18
    • Decimal Places = 0
    • Enter a description and help text
      • Data Type = Number
      • Field Label = No Of Cases Created This Year
      • Length = 18
      • Decimal Places = 0
      • Enter a description and help text
        • Data Type = Number
        • Field Label = Open Cases
        • Length = 18
        • Decimal Places = 0
        • Enter a description and help text
  1. Navigate to the DLRS App (click on the 9 dots to see all your apps and objects)
  2. Click on the Manage Lookup Rollup Summaries Tab
  3. The screen will default to a blank template to allow you to create a new Lookup Rollup Summary


Helpful hints:

  • You need to manually enter the ‘Lookup Rollup Summary Unique Name’ which is your ‘Lookup Rollup Summary Name’ with underscores between each word
  • The ‘Aggregate Result Field’ (the field you want your information to rollup to) should be the API name – that’s the one with underscores!
  • ‘Calculation Mode’ should be realtime
  • Calculation ‘Sharing Mode’ should be system (this will bypass any privacy restrictions)
  • Leave ‘Active’ un-ticked on the first rollup until you have deployed the child trigger via the ‘Manage Child Trigger’ button; then go back and activate the rollup (simply tick ‘Active’ and ‘Save’)
  • “Manage Child Trigger is how you can deploy and remove the apex code that this tool needs to run. You only need to deploy this one time per child object that you have DLRS running on. Example if you have 3 DLRS records all running on Opportunity as the child object you need only deploy the trigger one time.” Source: Getting Started With DLRS
  • The last step is to click ‘Calculate’ to run the rollup – this may take a while and I recommend doing one rollup at a time and making sure the calculate job has finished before doing the next one
  1. Create the ‘Total Open Cases’ DLRS:

open cases

  1. Create the ‘Cases Created This Year’ DLRS:

cases create this year

  1. Create the ‘Open Escalated Cases’ DLRS:

Open Escalated Cases.PNG

  1. Make sure you have run the calculate job on each rollup by clicking the ‘Calculate’ button!

Run Calculate Job.PNG

  1. Check your results by navigating to an account record and see if your fields have values in them (if yes then move on with the next steps, if no then try running the calculate job/s again)

Results DLRS.PNG

  1. Navigate to Setup > Object Manager > {Opportunities} > Fields & Relationships
  2. Create 3 new fields on the Opportunity object – make them visible to all profiles but DO NOT display on the Opportunity page layout:
    • Data Type = Formula
    • Field Label = Open Cases
    • Formula Return Type = Number
    • Decimal Places = 0
    • Enter a description and help text
    • Enter the following formula but use ‘Insert’ to ensure you use the correct API name:
      • Data Type = Formula
      • Field Label = No Of Cases Created This Year
      • Formula Return Type = Number
      • Decimal Places = 0
      • Enter a description and help text
      • Enter the following formula but use ‘Insert’ to ensure you use the correct API name:
        • Data Type = Formula
        • Field Label = Warning Escalated Case!
        • Formula Return Type = Text
        • Enter a description and help text
        • Enter the following formula but use ‘Insert’ to ensure you use the correct API name and replace the document ID (in red below) with your unique ID (hint – check the prerequisites section for where to find it!):
          IF( Account.Open_Escalated_Cases__c > 0,IMAGE("/servlet/servlet.FileDownload?file=0151o000005dxHe","Warning",16,16), 
  1. Once your new fields are created, navigate to Setup > Object Manager > {Opportunities} > Buttons, Links, and Actions > New Action
  2. Choose action type ‘Update a Record’, give it a name e.g. “Service Issues”, a description and save

update action opp

  1. Remove any fields you do not want to display (don’t worry about any fields having a red asterix)
  2. Add the fields ‘Open Cases’, ‘No Of Cases Created This Year’ and ‘Warning Escalated Case!”, then save (I also added my SLA field that I created in the previous tutorial)

action layout

  1. A warning message will appear – select ‘Yes’
  1. Navigate to your Lightning record page (Setup > Object Manager > {Opportunities} > Lightning Record Pages) and select ‘Edit’

edit lightning record page

  1. From the list of components (left) drag and drop a Related Record component somewhere highly visible on the canvas
  2. Select the component by clicking on it and set the component attributes:
    • Header Label = Service Issues (or similar)
    • Lookup Field = Use This Opportunity
    • Update Action = Service Issues (select the quick action you just created)

edit lightning layout

  1. Optionally, add some component visibility criteria so it only appears when relevant
    • Scroll down to the bottom of the component attributes column and select ‘Add Filter’
      • Field = Open Cases
      • Operator = Greater Than
      • Value = 0

Display conditionally.PNG

  1. Click ‘Done’
  2. Save, and if required, activate the page

The result

A clear warning to your sales users when there are ongoing service issues!


service issues

You could take this further by:

👍 Only displaying the Service Issues component on open opportunities

👍 Displaying a positive image (smiley face anyone?!) if there are no open, escalated cases (currently it will just be blank)

Gotchas & hints

*Our ‘Cases Created This Year’ DLRS query is using THIS YEAR. This is great but these don’t automatically calculate at the start of the year; the figures are only updated when the Case is edited. In layman’s terms, this means that at start of each new year, you need to manually force a mass update of all cases. You can go back to your DLRS queries and use the Schedule Calculate button to recalculate all the records.

*DLRS is probably the BEST thing I’ve ever installed as a declarative Admin…that being said, it can be a little confusing initially, so do join the Trailblazer Community Group or contact me if you need help with this tutorial!

Useful links

Declarative Lookup Rollup Summaries GitHub

Getting Started With DLRS

Counting Tasks with DLRS by Dan Kludgy

Declarative Lookup Rollup Summaries Tool Trailblazer Community Group

Salesforce Labs Graphics Pack


Total Open Cases Relationship Criteria:

Status  'Closed'

Cases Created This Year Relationship Criteria:

CreatedDate = THIS_YEAR

Open Escalated Cases Relationship Criteria:

IsEscalated = TRUE AND Status  'Closed'

4 thoughts on “🚩Warning! Unhappy customer ahead…🚩

  1. Oh my gosh I love this idea, however here is a warning for you when you go to implement this solution. Be careful about your wording when putting the comments in. If you are ever in a position where you share all your information about a contact with that contact (from federal regulations, etc), having a flag on that account that states “We have a badass over here” or “unhappy customer” could look not so kindly to that customer. Perhaps there may be gentle words to use on the account that would convey the same message internally and yet show the end customer that you still care.

    however, I LOVE the technical solution and I will most likely use this for some of our customers who are regular scofflaws. We have folks who love to get free stuff and not pay for them. Having some way of visually showing those on the screen for our agents would be great! Thanks. .


  2. Hi, I use the DLRS for the first time and have in the error logs CUSTOM VALIDATION RULES EXCEPTIONS. Any way to give a bypass to a DLRS job ? Our validation rules have a line with a BypassValidation

    validation rule condition=true

    Many thanks in advance.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s