Pages

Sunday, October 24, 2021

Salesforce: Topic in Lightning

Topic is another Salesforce feature that is probably not so well-known, but with good governance and maintenance, it served as a good tool to organize posts and records. Topics are case insensitive. 

Where to add Topics?
Topic is enabled by default for Chatter Post in Lightning. Topic also can be enabled for objects, follow this link to enable it.

To add topics in Chatter post:
  • start with # continue with the topic, for example, hello world, hit enter key then continue with the post, in this case, the topic is 2 words - hello world
  • You can have multiple topics in chatter port. 
  • As you type after #, the system will look for existing topics and you can simply select the existing topic.
To add topics into a record object:
  • Do not need to start with #, just type the topic and hit enter when done. 
  • Need to type in the Topics component in lightning, see post below for Topics component. 
  • You need to have edit permission on the record to be able to add topics to that record. 
  • Same with adding topics in the Chatter post, you can add multiple topics for a record, also as you type, the system will look for existing topics and you can simply select the existing topic.

If you open a topic, the topic in the Chatter post will show under Feed, while topics added to records will show under the Related tab.





Topics Component
Once you enabled Topics for an object, you need to add the component to the Lightning page, so your users can use it.



Reporting
You can run a report on Topic to see the usage, including the related records, you need to create a custom report type with Topic Assignments as the primary object.


If you do not have access to the record, you will not see the topic in the report too.


Search
You can search a topic from the global search box, you do not need to add # before the topics. see screenshot below, the one on the top is correct.



Deleting Topics
Only users with Delete Topics permission are able to delete a topic, this is only for the topic that relates to a record (not for a topic related to a Chatter post). Once the topic is deleted, topics added in the related record will be removed.



Reference:

Sunday, October 17, 2021

Tableau CRM: Getting Started with Recipe a.k.a Data Prep 3.0

Recipe has existed in Tableau CRM for a long time, but not really used a lot because Dataflow offers more powerful data transformation, although there are functions which only available in Recipe, such as Join. However, in the last few releases, Salesforce introduced a new term called "Data Prep 3.0", which actually is Recipe, and stop to enhance everyone's darling "dataflow".

When Data Prep 3.0 was introduced (I have no idea if there was Data Prep 2.0 and 1.0), it was not so popular because of the lack of functionalities, such as support to upload/download JSON, use SAQL, etc. Since then, in every release, more and more features are added to the Data Prep/Recipe, so it may be worth starting to look at it.

As per the Winter '22 release, at a glance, Recipe now looks quite promising, it supports many things: 

  • Download/upload recipe in JSON -- same with Dataflow
  • Formula with query -- comparable with computeExpression in Dataflow
  • Multiple row formula -- comparable with computeRelative in Dataflow


Here are things that are better in Recipe compare to Dataflow

  • Join (Left, Right, Inner, Outer) -- this is not available in Dataflow
  • Preview -- we cannot preview data in Dataflow
  • Layout stay when save -- you need EADashboardHelper in Dataflow
  • Multiple actions in a Transform node -- less node compare to Dataflow
  • Aggregate
  • Sentiments, Predict Missing Values, Cluster
  • Trim, Substring, Split, Uppercase, Lowercase, Replace -- some of them can be achieved with computeExpression in Dataflow
  • Format Dates, Bucket, Edit Attributes

Here are things that can be improved in Recipe
  • Ability to re-order items in Transform node 
  • Ability to re-order column in Preview data
  • Ability to sort and filter Preview data
  • Running a recipe does not show details in Monitor

A sample of Recipe


Formula in Transform node is based on TCRM SQL, so this is not SAQL, or SOQL.
for example: SQL
case 
when LeadSource = 'Partner' OR  LeadSource = 'Web'
then 'Partner Web'
else LeadSource
end

for example: SAQL
case 
when LeadSource == "Partner" OR  LeadSource == "Web"
then "Partner Web"
else LeadSource
end


Direct Data in Recipe

Winter '22 release also make Direct Data in Recipe become General Available. With Data Direct, you can access Salesforce live data in the recipe, not accessing data stored in Tableau CRM via sync. However, but sync needs to be enabled in the Tableau CRM to use this.

Another catch is, you cannot use direct data when the object has been sync to Tableau CRM, example: you have dataflow or recipe that sync Opportunities, then Opportunities will no longer be available for Data Direct, which is quite sad, sometimes we need to access the real-time data directly, not "obsolete" stored data in Tableau CRM.

When I search "Opportunity". because the opportunity object already syncs in Tableau CRM from other dataflow/recipe, it will only be available via Connected (in yellow), not Direct (in green)



If you have more things that not cover here or the information shared here is wrong, feel free to comment on this blog or reach me.



Wednesday, October 13, 2021

Salesforce: Email Template with Hyperlink

We shared about the Lightning Email Template seven months ago, as you read, it is easy to create an email template with merged fields, such as Account Name, Opportunity Name, etc.

However, those merge fields are not clickable (not hyperlink), so if the email sent is to your internal Salesforce users, it will be ideal if recipients are able to open the link directly from the email received.

Let's do a quick hands-on, in this example, I would like to build an email template for Case, contain 2 hyperlinks:

  • Case Number, to open the case
  • Account Name, to open the Account in the case

Here is the step:

1. Create the email template 

Create the email template as per normal, add all merged fields needed


2. Case Number hyperlink

Open a case from your browser and grab the URL and copy to a text editor, for example, https://d90000000ky88eag.lightning.force.com/lightning/r/Case/50090000001O98rAAC/view

Change the Case ID (as in red) and replace with {{{Case.Id}}}, now we have https://d90000000ky88eag.lightning.force.com/lightning/r/Case/{{{Case.Id}}}/view

Copy the above URL, select {{{Case.CaseNumber}}} from the email template, then click the Link icon (2nd from right) and paste the URL above (in the yellow background) here, then click the Save button.


3. Account Name hyperlink

Repeat the same for Account Name, get the URL and change the Account Id, so it will look like
https://d90000000ky88eag.lightning.force.com/lightning/r/Account/{{{Case.AccountId}}}/view 

Copy the above URL, select {{{Case.Account__c}}} from the email template, then click the Link icon (2nd from right) and paste the URL above, then click the Save button.

If you notice I use Case.Account__c, this is simply telling that I have a formula field in Case to get Account Name from AccountId.


4. Sending Email

Open a case and click the Email tab, select the email template created, and notice the email body is auto-populated with hyperlinks.



Reference:



Friday, October 1, 2021

Salesforce: Clone & Fields in Page Layout

Clone
  • When you clone a record, by default, fields that are not in the page layout will not copy to the new record.
  • If the record you’re cloning or a related record contains a field you don’t have access to, the field in the new record is blank.
  • If the record you’re cloning contains a field you have read-only access to, the field in the new record is blank.
  • If a related record contains a field you have read-only access to, the field value is copied into the new record.

Related List
When you create a child record from the parent Related List, even the parent field is not in the child page layout, the parent value will be populated.


Reference:

Sunday, September 19, 2021

Salesforce: Sharing Detail

More than 5 years ago, we wrote about Sharing Button URL, where you can check Sharing Detail and Access, which is useful to troubleshoot why a user is able to view or edit a record.

On the Sharing Detail page, it will show you all User, Public Group, Role, Role and Internal Subordinates and the access level. In this blog I am using Opportunity as a sample, Opportunity visibility in my org is Private.

https://johantest.my.salesforce.com/p/share/OppSharingDetail?parentId=0062H0000123456QAN


We can get the same result from SOQL: SELECT Id, OpportunityAccessLevel, RowCause, UserOrGroupId FROM OpportunityShare WHERE OpportunityId = '0062H0000123456QAN' ORDER BY UserOrGroupId 


Let us compare from Sharing Detail page:
  1. Sharing Detail #1 = SOQL row #7, reason = Account Sharing which = Implicit Child [in Account Sharing Rules, to Role]
  2. Sharing Detail #2 = SOQL row #6, reason = Opportunity Sharing Rule which = Rule [in Opportunity Sharing Rules, to Role and Internal Subordinates]
  3. Sharing Detail #3 = SOQL row #5, reason = Account Sharing which = Implicit Child [in Account Sharing Rules, to Role and Internal Subordinates]
  4. Sharing Detail #4 = SOQL row #4, reason = Opportunity Sharing Rule which = Rule [in Opportunity Sharing Rules, to Public Group] 
  5. Sharing Detail #5 = SOQL row #1, reason = Account Sharing which = Implicit Child [User is Account Owner] 
  6. Sharing Detail #6 = SOQL row #2, reason = Owner which = Owner [User is Opportunity Owner]
  7. Sharing Detail #7 = SOQL row #3, reason = Opportunity Team with Split which = Team [User in Opportunity Split]
  8. Sharing Detail #8 = SOQL row #8, reason = Account Sharing which = Implicit Child [in Account Sharing Rules, to Public Group]

Access level comparison:
- In Sharing Detail, Full Access = All in SOQL
In Sharing Detail, Read/Write = Edit in SOQL
In Sharing Detail, Read Only = Read in SOQL

Copy from Sharing Detail

  • Full Access - User can view, edit, delete, and transfer the record. User can also extend sharing access to other users.
  • Read/Write - User can view and edit the record, and add associated records, notes, and attachments to it.
  • Read Only - User can view the record, and add associated records to it. They cannot edit the record or add notes or attachments.
  • Private - User cannot access the record in any way.

Summary:
  • Sharing Detail page will only show User, Public Group, Role, Role and Internal Subordinates, but does not show: users in the higher role hierarchy of another user, users in the higher role hierarchy of a role hierarchy, users in the higher role hierarchy of user in Public Group. Click the Expand List button to see each user, access level, and the why.
  • Query to OpportunityShare will show the same thing as on Sharing Detail page, so you can't just depend on OpportunityShare to determine all users that have access to a record.


Reference:

Thursday, September 16, 2021

Tableau CRM : using SourceField in computeRelative node

The computeRelative node is useful to traverse across rows to identify something or calculate something.

Three important items in a computeRelative node:
  1. Partition By
  2. Order By
  3. Sort Direction (for 2 - Order By)

From the above screenshot:
- It is Opportunity 
- Partition By Account Id
- Order by CreatedDate and sort by Descending

The result in the calculated fields: 
- the first record in the partition would be the Last Opportunity created for an Account
- the last record in the partition would be the First Opportunity created for an Account
This is because we order by Descending.

There is two Expression Type in the calculated field for computeRelative: 
1. SAQL
2. SourceField

Use Case: to identify the First or Last or Previous record

using SAQL
SAQL Expression = case when previous(Id) is null then "Yes" else "No" end
* Id in above SAQL can be any fields as it just use to check if any previous record exists.



using SourceField
In this method, the new calculated field will contain "Yes" if that's the first row, the rest will be the Id from the previous record, which is not important.


Comparison
Based on my testing, using SourceField is faster than SAQL in the dataflow. In the below example, the dataflow processing close to 1.6 million rows




Page-level ad