Posts

Salesforce Fact #521 | ConvertLeads access check in LWC

How can we check ConvertLeads permission in LWC. This is how we can import the permission and check: import hasConvertLeadAccess from '@salesforce/userPermission/ConvertLeads';

Salesforce Fact #520 | GroupMember scenarios

Image
The GroupMember object keeps track of all queue and public group assignments. Let's see the scenarios: 1) When a user is added to a public group, a row gets created where the Group Id is the Public group Id and UserOrGroupId is the user Id. The Group type is Regular. 2) When a user is added to a queue, a row gets created where the Group Id is the queue Id and UserOrGroupId is the user Id. The Group type is Queue. 3)  When a public group is added to a queue, a row gets created where the Group Id is the queue Id and UserOrGroupId is the public group Id. The Group type is Queue. Attached is the screenshot.

Salesforce Fact #519 | Listview metadata in VS Code

Image
So, we have 3 types of sharing settings in list view: 1) Only I can see this list view. 2) All users can see this list view. 3) Share list view with groups of users. Now, let's see how they are represented in metadata  xml   format. For the 1st option, we cannot retrieve the metadata since this is private to that specific user and attempting to retrieve generates error: For the 2nd option, the sharing scope is denoted by the filterScope tag: For the 3rd option, the sharing for each public group is denoted by sharedTo tag:

Salesforce Fact #518 | View all & Modify all data check in LWC

Image
Do you know using the @salesforce/userPermission module, we can check the ViewAllData and ModifyAllData access for the current user in LWC. Attached are the screenshots.  

Salesforce Fact #517 | Status field on Entitlement object

Do you know the Status field on Entitlement object is not a writeable field. It can have the below statuses: Active if the system date is equal to or later than the Start Date and equal to or earlier than the End Date. Expired if the system date is later than the End Date. Inactive if the system date is earlier than the Start Date . Reference:  https://help.salesforce.com/s/articleView?id=sf.entitlements_fields.htm&type=5  

Salesforce Fact #516 | Delete all white spaces in apex string

Image
In Apex, we have the trim() function to remove the leading and trailing spaces from the string. But what if we want to remove all the white spaces from the string. There is a method deleteWhitespace(). Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_System_String_deleteWhitespace Attached are the screenshots.

Salesforce Fact #515 | Get Community context for LWC

Image
Suppose we need to check whether the current context of the LWC is in community or internal page. We can use a checkbox and set it to true while adding the LWC in community page and for internal, keep it as false. Attached is the screenshot.