Posts

Showing posts from May, 2023

Salesforce Fact #686 | Email approval error

Image
What happens when the approver does not have access to the record, but tries to approve/reject the request from email response. An email is received stating that the user does not have access to update the referenced object. Attached is the screenshot.

Salesforce Fact #685 | Record lock check in flow

Image
We can create an Invocable method to check whether a record is locked or not. It is useful whenever we need to check the same in flow. Attached is the screenshot.

Salesforce Fact #684 | Transaction security policy for query

Image
Suppose we want to restrict all the users from querying and extracting data from the Account object. We can create a transaction security policy on the API event for the same. Attached are the screenshots.

Salesforce Fact #683 | Simple & composite filters

From the perspective of query optimizer, A query filter can be simple or composite. A simple filter is one where each of the field expression in the condition filters uses the 'AND' operator. Whereas, a composite filter is one where two or more field expressions in the condition filters uses the 'OR' operator. Reference:  https://help.salesforce.com/s/articleView?id=000385218&type=1

Salesforce Fact #682 | IsPortalEnabled

How to check whether a user is a community user in code. There is a boolean field on User object named 'IsPortalEnabled' which indicates whether an active, external user has access to experience sites or portals. This field can be accessed in flows and triggers to check the user context. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_user.htm

Salesforce Fact #681 | Null check on screen flow dependent picklist

Image
Screen input component values are set to null when they're hidden by conditional visibility. But hidden picklists in a dependent picklist component aren't set to null unless the entire dependent picklist component is hidden. In this example, we have a dependent picklist component and a text input component in the screen flow. We have hidden the text component and also we are not selecting the third level picklist value i.e. it is hidden as well.  When we are doing a null check, for picklist value it is not equal to null whereas for the input text it is set as null. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_dependentpicklists.htm&type=5 Attached are the screenshots.

Salesforce Fact #680 | Tasks assigned to public groups and queues

Image
Task can be assigned to Public Groups and Queues. While assigning a task to a public group, it considers each user present in the public group and those many tasks are created. But while assigning a task to a queue, it assigns to the queue directly and only one task is created. Attached are the screenshots.

Salesforce Fact #679 | Geolocation field limit

Geolocation is a compound field that count towards the org's limits as three custom fields: one for latitude, one for longitude and one for internal use. Reference:  https://help.salesforce.com/s/articleView?id=sf.custom_field_geolocate_overview.htm&type=5

Salesforce Fact #678 | List in AuraEnabled methods

Image
AuraEnabled methods cannot return of type List<SelectOption>. So, one of the option is to create a custom SelectOption class and return the data. Reference:  https://developer.salesforce.com/forums/?id=9062I000000IN7YQAW Attached is the screenshot.

Salesforce Fact #677 | Flow security

Permission for a flow is checked only at the top level. For example, flow A calls flow B. User X has a profile that can access flow A but not flow B. User X can execute flow B, but only through flow A. User X can’t execute flow B directly. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_distribute_security.htm&type=5

Salesforce Fact #676 | Get readonly fields in page layout using apex

Image
Using Metadata class methods, we can get the list of fields present in a particular page layout. Suppose we need to find out the list of ReadOnly fields in a page layout, we can get the same using a condition check on  Metadata.UiBehavior enum. It has three values: ' Edit ', ' ReadOnly ' & ' Required '. Reference:  https://salesforce.stackexchange.com/questions/179442/apex-metadata-api-layout-read-only-fields-being-added-as-read-write Attached is the screenshot.

Salesforce Fact #675 | Get day of week in apex

Image
We can check day of week in apex class using the format() function of DateTime class.  If it takes the parameter 'EEE' corresponding to a datetime, it returns the abbreviated day name. And i f it takes the parameter 'EEEE' corresponding to a datetime, it returns the full day name. Attached is the screenshot.

Salesforce Fact #674 | It's 'recordTypeId' in LWC

Image
While passing a RecordType Id in LWC NavigationMixIn, the correct attribute is 'recordTypeId', and not 'RecordTypeId'. Reference:  https://salesforce.stackexchange.com/questions/254498/lightning-web-components-navigate-to-the-new-object-page-passing-in-specific Attached is the screenshot.

Salesforce Fact #673 | Navigate to record type selection page

Image
We can use the 'useRecordTypeCheck' property in LWC NavigationMixin in order to navigate to the standard record type selection page while creating a new record. Reference:  https://salesforce.stackexchange.com/questions/254498/lightning-web-components-navigate-to-the-new-object-page-passing-in-specific Attached is the screenshot.

Salesforce Fact #672 | Create public links option

Image
We can control the public link option while sharing files. It can be enabled or disabled across the org from the below settings: Setup -> Content Deliveries and Public Links -> Under Enable, check/uncheck 'Public links can be enabled for users'. Checking this option, makes the system permission 'Create Public Links' available in the profiles and permission sets. Attached is the screenshot.

Salesforce Fact #671 | Custom wrapper initialization

Image
Unlike Sobjects, custom apex defined wrapper types cannot be initialized with name=value pairs. Note: However, parameterized constructor would work. Attached are the screenshots.

Salesforce Fact #670 | Translation for screen flow navigation button labels

If we are using custom label value for the Previous/ Next/ Pause button in the screen flow instead of the standard button labels, we can add the translation for the same using translation workbench. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_custom_footer_labels.htm&release=236&type=5

Salesforce Fact #669 | Get available record types in screen flow

Image
In order to check in which all record types the current user has access in screen flow, we can write an invocable apex method which makes use of the getDescribe() method and return the results. In this example, we are checking the record type access for the current user for Account object. Attached are the screenshots.

Salesforce Fact #668 | Country, State picklist in screen flow

Image
We can show the standard country and state picklist values in screen flow using the Dependent picklist type input. The controlling picklist is the country field and the api name would be the country code for eg. ShippingCountryCode. The dependent picklist is the state field and api name would be the state code for eg. ShippingStateCode. This dependency can be specified till 3 picklists. In order to get the selected picklist values, the top, middle and bottom attributes i.e. topPicklistApiName, topLabel, topRequired, topValue are used. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_dependentpicklists.htm&type=5 Attached are the screenshots.