Pages

Friday, October 14, 2022

Salesforce Scoping Rules

Quote from a Salesforce article "Scoping rules let you control the records that your users see based on criteria that you select. You can set up scoping rules for different users in your Salesforce org so that they can focus on the records that matter to them. Users can switch the set of records they’re seeing as needed."

As above, scoping rule is not similar to the restriction rule, where the restriction rule prevents the user to access certain records, while scoping rule is just to scope for the user to focus on a set of records, so users can still access all other records that they can access according to the sharing rules settings.


As of now (Winter '23 release), scoping rules are available for custom objects, Account, Case, Contact, Lead, Opportunity, Event, and Task. It is available in Unlimited or Performance edition, if you use Unlimited or Performance edition but do not see scoping rules available in the objects mentioned above, reach out to Salesforce support to enable it.

When a scoping rule is applied to a user, the data that the user sees in list views and reports are filtered by the criteria you set.

Follow this article to create scoping rules, there are 2 options for User Criteria when creating a scoping rule:

  1. Criteria Type = User Criteria
  2. Criteria Type = Permission Criteria


User Criteria, select a field in the user object as the criteria of who the rule will apply, unfortunately, you can't use the field of the child object such as Profile Name or Role Name at this moment, so just using their Id will work, and there is no option to set multiple criteria and use AND logic.

On the Record Criteria, set criteria to filter records that fit into the scoping. Here you can use the field from a child object, but no option to set multiple criteria and use AND logic.



Permission Criteria, this uses custom permission, then defines the custom permission under the permission set, then assigns users to that permission set. 



Once the custom permission and the permission set are created, you can use the custom permission in scoping rule.



Make sure the scoping rule is active and let us see how it works in the list view and report. In the list view Filter by Owner, select Filter by scope.


The same for the report filter, select Filter by scope.



The result of the above list view and report is based on the record criteria defined in the scoping rule. As you see that "Filter by Scope" is just an option, meaning your users can select other filters option too.

Known Issue: if the User Criteria contain space, this will not be saved by the scoping rule, and this cause the scoping rule will not to run for the users defined, check out this.


Reference:




Thursday, October 13, 2022

Salesforce Case Closed Date

Case object in Salesforce is a bit different and special compare to other objects. There are additional fields such as Date/Time Opened and Date/Time Closed. 

The Date/Time Opened field value is the same as the Created Date field in other objects, this field can be added to the case page layout.

The Date/Time Closed field is auto-populated when the case status is changed to system Closed, this field can be added to the case page layout too, but the field is not available for history tracking.


Report

In the report, there are additional fields available as screenshot below:


Each pair have the date time field and date only field:

1. Date/Time Opened with Opened Date

2. Date/Time Closed with Closed Date

3. Case Date/Time Last Modified with Case Last Modified Date

But, the Created Date field will not available for reporting in Case.


Date/Time Closed field

As mentioned above, when the case status is changed to system closed, the date/time closed field will be auto-populated as when the case is closed.

However, when the case is re-open, the value of the date/time closed field will be set to blank and populate back with when the latest case is closed.


SOQL

Sample SELECT Id, CreatedDate,ClosedDate FROM case WHERE Id = '5000o00002J2JQzAAN'


The format for both fields here is date/time.




Salesforce Einstein Insight


Einstein Account Insight and Opportunity Insight are part of Sales Cloud Einstein. Recently, a few items from Sales Cloud Einstein are added as part of the Unlimited or Performance edition, which includes:

  • Salesforce Inbox
  • Sales Engagement (formerly High Velocity Sales)
  • Sales Cloud Einstein Included, which is: Einstein Opportunity Score, Einstein Lead Score, Einstein Forecasting, and Einstein Automated Contacts.

However, Einstein Insight is not included in the Unlimited or Performance edition. So, you still need to get the additional Sales Cloud Einstein licenses, even if you are in the Unlimited or Performance edition.

So, what is inside Sales Cloud Unlimited and Sales Cloud Einstein permission set?

Sales Cloud Unlimited permission set license
Notice that both Einstein Insights are not in the above permission set license.


Sales Cloud Einstein permission set license

Once you have the license acquired, a few steps need to be performed:

  1. Enable Einstein Account Insights
  2. Enable Einstein Opportunity Insights
  3. Assign users with the "Sales Cloud Einstein" permission set

Once the setup is completed, the system will take up to 24 hours before the initial batch of insights is available, so not all accounts and opportunities will have insights. You will see the insights as a component in the Home, Account, and Opportunity record pages.

How to see records that have Insights?

For opportunity, create a list view and add the "Top Insight" column, additionally, you also can see it from the "Einstein Opportunity Insights" tab, make sure to enable the "Einstein Opportunity Insights" tab for the profile.

For account, unfortunately, we don't have this in the list view (as per Winter 23 release), so only from the "Einstein Account Insights" tab, make sure to enable the "Einstein Account Insights" tab for the profile.

Unfortunately, you cannot run a report to export the insights, so vote for this idea. However, you can query AccountInsight and OpportunityInsight objects, sample:

SELECT Id, AccountId, Title, TrendType, Type from AccountInsight 



SELECT Id, OpportunityId, Rationale, Title, TrendType, Type from OpportunityInsight 




Reference:

Wednesday, September 7, 2022

Salesforce: Dynamic Related List

We discussed dynamic form here and here, dynamic actions here, and this blog will continue with Dynamic Related List. 

So, what is the dynamic-related list? The dynamic related lists allow you to choose the list’s fields and sort order, apply filters, specify the component label, and configure actions for the related list, without dependency on page layout. 

To set up a dynamic related list, add the Related List - Single component, then upgrade it to Dynamic Related List - Single. 



Click the "Upgrade Now" button to upgrade it to Dynamic Related List - Single


** As per the Winter '24 release, you can simply drag Dynamic Related List - Single, no need to upgrade from Related List - Single component.

Limitation/issue as of Summer '22 release:

  • If you have the Related List Quick Links component, the Related List - Single / Dynamic Related List - Single component will not be available in the Related List Quick Links component
  • Dynamic Related List - Single component will show only up to 10 records and does not have "View All", vote for this idea (by now, the idea has been delivered).
  • To use Related List - Single, the related list must be added to the current page layout.
  • Dynamic Related List - Single does not support all objects; please vote on this idea Dynamic Related List - Single to support all objects

Notes:
  • Because it is an independent component, you can have many Dynamic Related List - Single components, such as one component showing Open Cases and another one showing Cases closed in the last 30 days. 


Reference:


Sunday, August 28, 2022

Salesforce: Dynamic Forms (2)

After 18 months from my first dynamic form blog, we finally see a few standard objects covered by the dynamic form. As per the Winter '23 roadmap, we can enable Account (incl. person Account), Contact, and Opportunity with dynamic form.


Overall, the dynamic form functionality is still the same as per the initial release, where we can show/hide each field based on Record Field or Advanced, field with filters defined will have the eye orange icon next to it.



Record Field
  1. Field: another field in the same object
  2. Operator: depends on the selected Field (1) type, e.g. Contains, Equal, Not Equal
  3. Value: also depends on the selected Field (1) type
Advanced
  1. User, which is user info/detail
  2. Permissions, if the user has specific permission 
  3. Record, this can be a value from a related field, such as Created By Profile Name
Tips: 
you can't select more than 1 value in each filter, but you can add the same field in filters, then use "any filters are true" or filter logic.

Samples of use cases to use the dynamic form

  1. To hide/show fields from a specific profile in the layout, even the profile has visibility on the field-level security
  2. To hide/show fields from users without permission, such as View and Edit Converted Leads
  3. To hide/show field when the user selects a value, such as, when user Type = Customer, show Customer No, otherwise, hide Customer No field

But, do we still need the classic page layout when using the dynamic form? 

1. Record buttons are still determined by page layout, you can handle this by enabling dynamic action, check out here.

2. Related lists are also determined by page layout, you can handle this by removing the "Related Lists" component and adding the Related List - Single component for each related object. However, if you use the "Related List Quick Links" component (which is a great feature since Classic), adding "Related List - Single" will not add the object to "Related List Quick Links", so come and vote for this idea. 




Wednesday, August 17, 2022

CRM Analytics: Trend dataset with Dataflow or Recipe

Background: The dataset produced is only for the last 30 days of data, but we need to keep the data for much longer.

Solution: use dataflow/recipe to store the trend in a new dataset

1. Download the dataset in a CSV file and load it as a "trend" dataset

2. Use dataflow/recipe to read from the original and trend dataset

3. Append both datasets

4. Use computeRelative node (dataflow) or "Multiple row formula" transformation (recipe), Partition By the key field, this is to mark the 1st record

5. Filter out rows not marked as 1st record

6. Done


Recipe


Multiple row formula




Page-level ad