Pages

Sunday, May 14, 2023

CRM Analytics: Multivalue field

We shared a blog about working with multivalue fields almost two years ago with dataflow, where we read the multivalue field as a text field and used the computeExpression node to create a multivalue field. 

In this blog, we have something similar, except the source field is a text field separated by comma.

Here is the sample data in Salesforce:



The need: to have a list widget in CRM Analytics, so the user is able to filter the dashboard by Segment, where it should be a single, from the above screenshot: AA, GB, MM, SMB. So, if the user selects SMB, this will filter the data to ABT Inc, Adams335 Inc, and Adams991 Inc.

Solution: we can use dataflow as explained in the previous blog, or make use of the recipe as below screenshot: 


We can make use of both original and newly created fields from the recipe in the dashboard, use the text field in the table, and the multivalue field in the list widget:





Tuesday, May 9, 2023

Salesforce: Dynamic Forms controlling Field Type

One of the benefits of using the dynamic form is the ability to show and hide fields live based on other fields' values selected or entered. 

But, not all field types can be used as a controlling field, as per Summer '23 release, here is the list of field types that can be used: 

  • Auto Number
  • Checkbox
  • Currency
  • Email
  • Formula (Number) 
  • Formula (Text)
  • Number
  • Percent
  • Phone
  • Picklist
  • Text
  • URL

And following types are not supported as a controller field:
  • Date
  • Date/Time
  • Lookup
  • Picklist (Multi-Select)
  • Rich Text Area
  • Text Area


CRM Analytics: Adding existing widget to different layouts

Background: we have a CRM Analytic dashboard with default (web) and mobile layout. As the business grows and changes, we need to add more widgets to the dashboard.

Adding widgets to a dashboard is easy by dragging and dropping the new widget into the canvas. But, doing the same activities two times on web and mobile layout is not fun.

So, here is the step to "copy" the widget from one to another layout:


1. Find the ID of new widgets in the source layout

Note down the widget ID.



2. Open the target layout

Looks for the widget Id in "Unused Widgets", and drag it to the canvas of the new layout.





Sunday, April 23, 2023

Salesforce: Dynamic form by Record Type

Background: Universal Container uses many record types in the Case object, one of the new requests is fit to use the dynamic form feature, but does not want to impact all existing record types which still use page layout.

Solution: create a new lightning record page (or clone from the existing one) and assign it to:

  •  A specific app
  • The new record type
  • All profiles that will use the new lightning record page 



Reference:


Saturday, April 22, 2023

Salesforce: Query all Objects

As admin/developer, you can easily see all objects available in an org., but sometimes we need to get the list of the objects. Of course you can manually copy and paste from the Object Manager, but that is not ideal. 

Salesforce provide ability query using Tooling API from version 32.0 and later. EntityDefinition provides row-based access to metadata about standard and custom objects.

Sample query: 

SELECT QualifiedApiName, Label, ExternalSharingModel, InternalSharingModel, DurableId, DeploymentStatus, NamespacePrefix, Description, LastModifiedDate, LastModifiedById FROM EntityDefinition ORDER BY QualifiedApiName 


Compare from the Object Manager UI, using query, you also can also get the object sharing model, last modified by, DurableId. In this query, DurableId is the object Id, if you open a custom object from object manager, e.g. https://domain.lightning.force.com/lightning/setup/ObjectManager/01I50000000RAjx/Details/view, the one in bold is DurableId. While for standard object such as Account, the DurableId is Account, e.g.  https://domain.lightning.force.com/lightning/setup/ObjectManager/Account/Details/view

01I prefix is for CustomEntityDefinition


Reference:


Monday, January 30, 2023

Salesforce: Field History Tracking for Activities

Activity in Salesforce is represented by Task and Event objects, they are special objects with a few limitations compared to other standard and custom objects, one of them being field tracking.

Before the Spring '23 release, you can't track field changes in the Activity, with community members creating and voting this in IdeaExchange that earned 33000+ votes.

The spring '23 release allows us to track activities fields history, with some limitations, but it is definitely a good starting. 

Navigate to the Task or Event object and click the "Set History Tracking" button and select up to 6 fields.

You can add the Activity Record History component from Lightning App Builder.



Here is the sample result in a Task:



Unfortunately, I don't see this yet in reporting, hope this will come in coming releases, or let me know if you see this. But you can query with API to object ActivityFieldHistory.

sample query: SELECT Id, ActivityId, ChangedBy.Name, FieldName, OldValueText, NewValueText  FROM ActivityFieldHistory 

I have no idea why the Ids are 000000000000000AAA, hope will see some explanation in the future.


For more information, looks for Event and Task History Considerations in this article Field History Tracking (as per Spring 23 release):

  • It can take up to a few minutes for changes to appear in history.
  • You can track up to six fields on events or tasks.
  • After an activity is deleted, the history for the activities can be visible via API queries for up to a few days. The history remains available because it’s deleted asynchronously from the activity.
  • Not all changes to recurring and child events are tracked.
  • You can’t delete specific field history records.
  • Bulk processes such as Bulk API transactions or event syncing can be delayed when field history tracking is enabled. If processes are delayed, consider turning off activity field history tracking.
  • The parent record of an activity is locked when the activity history updates. For example, if an activity is linked to thousands of accounts, each account is locked while the history updates. As a best practice, avoid data skew. If processes fail because of parent-child row locking, consider turning off activity field history tracking.
  • Field value changes caused by process builder, Apex triggers, or flows are tracked in an activity’s history. Users see the change only if their field-level security settings permit them to. In other objects, field changes from processes, triggers, and flows are tracked only if the current user has permission to edit the modified fields.
  • If a previously encrypted field used for tracking is unencrypted, the values tracked while the field was encrypted don’t appear. After the field is unencrypted, the values are tracked in history.
  • Activity history is available in APIs only for admins with permission to modify all data.
  • For activities, field history is shown in a Lightning component that looks like a related list. Instead of managing the history on the page layout, you place the Activity Record History component on Lightning pages for event and task records. You can add the Activity Record History component to custom event and task pages or remove it from the default pages. The history list stays empty until you turn on field history tracking in the Object Manager.
  • The history list isn’t available in Salesforce Classic or in the mobile app.


Reference:



Page-level ad