Trigger Account Health Check

Share

Free Salesforce business guides to help admins/developers, project managers, sales managers, and decision makers. Download the free PDF series now: Reinventing Your Business, Reimagining Your Salesforce®.

Problem

Apex triggers enable you to complete custom actions, such as insertions, updates, or deletions, before or after events to records. Similar to database systems that support triggers, Apex provides trigger support for managing records.

Typically, you use triggers to perform operations based on specific conditions such as modifying related records or restricting certain operations from happening. You can use triggers to do anything you can do in Apex, such as executing SOQL and DML or calling custom Apex methods.

If you need to trigger an automated health check on an account with a workflow, all you need to do is check if an account has more than X number of cases open. This workflow could then notify management to review the cases with a full account review. All you need to do is have Rollup Helper create an open count of cases, then use a workflow at the account level to evaluate this. 

Solution

In order to do this, first create a Rollup which will return the number of open cases the account has. 

To create the Rollup follow these steps:
  • Create a custom number field on Account in Salesforce through the Object Manager from the Setup page. The name of the field can be: Number of Open Cases.
  • Go to Rollup Helper and create a new Rollup Helper Setting.
  • The first choice will be to select the target object, the object you will Rollup to, this will be Account.
  • Next will be to select the Target field, which will be the Number of Open Cases field which was just created.
  • On the Step 3 page of the Rollup Creation Process 
    • Select Case as the child Object and use default relationship field: Account ID - Quote.AccountId 
    • Select Rollup Type: Count
    • You do not need to change the source field, as the default IsDeleted will be best for this use case.
    • You will then want to create a filter so that only Open Cases are counted. Use the Create a Filter button to go to the filter creation page.
      • Provide a meaningful name to the filter, a limit does not need to be set. In Step 2 a sort will not need to be set either. In Step 3 set the filter conditions to only include case records that are still considered open. Once this has been done you can save the filter to go back to the last page of the Rollup Creation process.
  • After the filter has been created, you can use the Save and Run to complete the rollup
In order to complete this Use Case, the next step will be to create a Salesforce Workflow rule and email alert which will run when that Rollup result exceeds a given amount. This workflow could then notify management to review the cases with a full account review. You can find documentation from Salesforce on creating Workflow Email alerts here:
https://help.salesforce.com/articleView?id=sf.workflow_rules_new.htm&type=5 

If you have any questions and would like to discuss further, please contact us

Tags: Account, Case, COUNT
Count number of campaigns on a lead record Rollup Helper Use Case Library Campaign Metrics - First Campaign Name