How to set password of a user using Apex
NOTE method The first parameter of that function call is the actual id of the user object. User Ids start with 005 and are 15 or 18 characters long and second parameter is password string. Complex password generation TIPS
How to access Compound field values in Apex Salesforce
What is compound field? Compound field – for example Address and Geolocation – binds together multiple information into a single unit. Like Address is one unit of information but actually it is comprises of different primitive information like Street Address, City, State, Country & Postal Code. Can we query/access address field without addressing individual field …
How to access Compound field values in Apex Salesforce Read More »
How to check Person Account is enabled in Salesforce org or not using Apex
If Person Account is enabled then there must be a field on Account object called: isPersonAccount. We simply need to check if exists as below. Method 1 METHOD 2
UNKNOWN_EXCEPTION:portal users cannot own partner accounts
ERROR DESCRIPTION WORKAROUND Follow us on LinkedIn: Click here
How to Query External Object in Salesforce?
Introduction Query on external object is supported with some limitation. Here is Salesforce help article: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_limits.htm Sample Query SELECT Id, Name__c, OrderNumber__c FROM ExternalOrder__x WHERE Name__c LIKE ‘%Software%’ Additional Notes
Create Messaging User for WhatsApp Channel in Salesforce
If you are using Digital Engagement also called Messaging of Salesforce, you may come up with a requirement to create messaging user record automatically. Here are key fields that we need to provide while creating the messaging user. Given example is to be used in Apex but same can be used in flow: For more …
Create Messaging User for WhatsApp Channel in Salesforce Read More »
Create and update custom labels using Tooling API
GOAL To be able to create custom label along with translation programmatically. SOLUTION We can use tooling API to create the custom label and its translation as below. The Master label is stored in External String and translation is stored in ExternalStringLocalization Request to create master label: Endpoint Payload Response We can grab the Id of Master Label …
Create and update custom labels using Tooling API Read More »
Get Community/Digital Experience Site Base URL in Apex Dynamically
If you are using Salesforce Community and you have network Id of the community but I don’t know how to get Base URL of the community. Here is a way to get the community base URL using its id in apex: Usage: Id communityId = Network.getNetworkId(); getCommunityURL(communityId);
How to trigger a flow from apex in Salesforce
In this blog, we will discuss on how to invoke a lightning Auto launched flow from the apex class. 1. It works only with autolaunched Flow. 2. Use the start method in the Flow.Interview class to launch an autolaunched flow or user provisioning flow from Apex. 3. In this example, we will use a visualforce page where flow will be invoked …