Insights
Introduction
Wattyo Insight Module allows you to highlight most relevant information related to a specific record. In this way, you can define a series of Insights for any object in your Org and cards with information and possible actions will appear without the need of code.
The Insights Lightning Component is available to be added to any Salesforce Object Lightning Page. When added to a Page, every time that page is loaded, all the insights related to the base object of the page are evaluated.
graph LR A[Loading Record Page] --> B[Get Insights for Object] B --> C(Evaluate Insights) C --Return Insights--> A
In order to create a new Insight you need to create a new Insight record (wattyoInsightc) and define its properties:
Property | Definition | Sample |
---|---|---|
Insight Name | Name of the insight configuration. This property is required. | Pending Order |
Object | Indicates the Salesforce Object API Name related to the Lightning Page where the Insight Lightning Component will be added. This property is required. | Account |
Active | Checkbox that indicates if the insight is active or not. | true |
Start Date | Indicates the starting Date and Time from when the Insight is active. If blank, the Insight will be considered as active from a Starting date perspective. | 2023–04–01 19:00:00Z |
End Date | Indicates the End Date and Time to when the Insight is active. If blank, the Insight will never expire. | 2023–04–30 19:00:00Z |
Subject | Title of the Insight that will appear next to the Icon in the Insight Card. This property is required. | Pending Order |
Body | Useful to give the user more detailed information. The text appears under the title and can refer to Insight criteria such as number of records encountered, sum of any amount, record name or any other attribute returned by the Insight. | Customer has pending {criteria.Balance__c} from {criteria.Due_Date__c} |
Help Text | Help Text displayed in the top right corner of the card when scrolling over the i icon. | Refers to the most recent unpaid bill invoice |
Type | Used to categorize the Insights using a color palette where $color{blue}{textsf{Info is Blue}}$, $color{green}{textsf{Success is Green}}$, $color{yellow}{textsf{Warning is Yellow}}$, $color{red}{textsf{Error is Red}}$, and $color{grey}{textsf{None is Grey}}$. | Info |
Icon | Icon picklist allows to select an icon from the SLDS (Salesforce Lightning Design System) Icons. The color of the Icon will be determined by the property Type. | end_call |
Priority | Number that represent the level of Priority of the insights. The lower the number, the higher the priority will be. Priority is used to order the insights order of appearance from left to right being the highest one the first to appear. | 1 |
Tags | Assigned tags can be used to filter the insights and show only in the appropiate pages. | Billing |
Profile | Comma separated list with the Profiles that will see this Insight. If blank, it will apply to all profiles. | System Administrator, Read Only |
Criteria Type | Specifies how the Insight is going to be evaluated, either and SOQL query or Apex class that implements the interface Evaluable. | SOQL |
Criteria Subtype | If criteria Type is Apex, the subtype needs to be Evaluable Interface. If the type is SOQL, the subtype can either be count>0 or select. | select |
Criteria | SOQL or Apex class to be used to evaluate the Insight. If subtype = count>0, Criteria must contain ‘count()’ in lower case or it would not work. For subtype select, aggregate functions can be used, as well as aliases that can be referred using ‘criteria.’ in Body and Title. Only queries that returned a single record will work. To refer to the id of the object being evaluated, please use :recordId. |
Subtype = count>0Select count() from Invoice__c where Account__c = :recordId and Due_Date__c <TODAY and Balance__c >0 Subtype = select Select id, TaskSubtype, Subject, format(ActivityDate) from Task where AccountId = :recordId and ActivityDate = LAST_N_DAYS:7 order by createddate desc limit 1 |
Is Async | Async Insights are executed in Async mode. Async Insights will be executed in parallel during the page load, and can appear after the pages has loaded. | false |
Accept Label | Label of the link presented in the bottom left corner of the Insight card | View Orders |
Accept Action Type | Possible values are Navigate to record: record id needs to be provided Advanced Navigation: json for page reference Execute Apex Execute Flow |
Navigate to Record |
Accept Action | Indicates the appropiate action for the defined action type | Navigate to Record{criteria.Id} Advanced Navigation { "type": "standard__recordRelationshipPage", "attributes": { "recordId": "{record.Id}", "objectApiName": "Account", "relationshipApiName": wattyo__Invoices__r", "actionName": "view" } |
Cancel Label | Label of the link presented in the bottom right corner of the Insight card | View Orders |
Cancel Action Type | Possible values are Navigate to record: record id needs to be provided Advanced Navigation: json for page reference Execute Apex Execute Flow |
Navigate to Record |
Cancel Action | Indicates the appropiate action for the defined action type | Navigate to Record{criteria.Id} Advanced Navigation { "type": "standard__recordRelationshipPage", "attributes": { "recordId": "{record.Id}", "objectApiName": "Account", "relationshipApiName": wattyo__Invoices__r", "actionName": "view" } |