Category: Spring 21

Fetch All Fields In SOQL Query | Spring 21 New Feature

 If you worked with SQL or any other query language before, you probably familiar with Select * from …, right? This is the way to fetch all fields from a particular table in other(mostly all) query languages. But in the Salesforce world, we were not having this feature. In SOQL, there is nothing with which we can fetch all the fields unless we specifically mention all the field names in the query.But now in Spring 21, Salesforce is bringing a function through which we can fetch all fields in SOQL Query.We have now FIELDS(ALL), FIELDS(STANDARD), and FIELDS(CUSTOM) which we can use in the SOQL query.FIELDS(ALL) – This fetches all the fields of an object. This is similar like Select * from SQL.FIELDS(STANDARD) – This fetches all standard fields of an object.FIELDS(CUSTOM) – This fetches all custom fields of an object.Here is how the query will look like -List<Contact> allConatcts = [SELECT FIELDS(ALL) FROM CONTACT LIMIT 200];In Subqueries, it will look like -List<Account> allAccounts = [ SELECT Account.Name, (SELECT FIELDS(ALL) FROM Account.Contacts LIMIT 200) FROM Account];BOUNDED AND UNBOUNDED QUERIESWhen API cannot determine the set of fields in advance, then it will consider query as Unbounded Query, other if API can determine the set of fields in advance, then it is Bounded Query. For example – The number of custom fields for an object is not pre-determined, so FIELDS(CUSTOM) and FIELDS(ALL)...

Read More

Top Admin Features from Spring 21

 Going through the entire release note is difficult and time-consuming. So in this post, I tried to share some of my most favorite admin features from the Salesforce Spring 21 release.In my earlier post, I have shared Top Apex Features from Spring 21 release. You can check the post here.Also if you prefer more video content, please check out my Youtube Playlist covering Salesforce releases here.Feature 1 – Share Records with Manual SharingWith this new feature, now we can share records and manage record shares in a new streamlined interface. Before this one, we need to go to Salesforce Classic to share records with specific users or user groups. Manual share is available only for accounts, contacts, opportunities, cases, leads and custom objects.Feature 2 – No more support for Internet Explorer 11 in Lightning ExperienceStarting Spring 21, Salesforce will no longer support Internet Explorer 11. Users can still use IE11, but they will be presented with a message stating that they are using unsupported browser. Any new features from Salesforce will be supported and available only on modern browsers.Feature 3 – Can create more rolesAny Salesforce org created in Spring 21 and later, we can now create up to 5000 roles. In the existing org, the maximum number of roles allowed is 500, but in order to increase the limit, we need to contact Salesforce support.Feature 4 – Opportunity...

Read More

How to Convert Leads to a Person and Business Account at the Same Time | Spring 21 New Feature

 If in your Salesforce Implementation, you are dealing with both individual and group accounts, then with the release of Spring 21, now you can link your converted leads into both individual and group accounts with the new LeadConvert Methods.Note This feature is only available in Enterprise, Performance, and Unlimted Editions.VideoIf you prefer video, here is the youtube video MethodsThe new LeadConvert methods will allow you to link converted leads into a business and person account instead of a contact. Below are the methods available -getRelatedPersonAccountId() – Gets the Id of an existing person account to convert the lead into.setRelatedPersonAccountId(String personAccountId) – Sets the Id of an existing person accoung to convert the lead into.getRelatedPersonAccountRecord() – Gets the entity record of a new person account to convert the lead into.setRelatedPersonAccountRecord(Entity relatedPersonAccountRecord) – Sets the entity record of a new person account to convert the lead into.LeadConvertResult class holds the result of the lead conversion.Example 1The below example uses the existing personAccountId to convert the lead into. After the execution of this method, lead with id leadId will be converted into both business account with id businessAccountId and person account with id personAccountId.public static void convertLeadWithExistingPersonAccount(String leadId,     String businessAccountId, String personAccountId, String opportunityId) { Database.LeadConvert lc = new Database.LeadConvert(); lc.setLeadId(leadId); lc.setAccountId(businessAccountId); //New Method to use the existing person account id to convert the lead into. lc.setRelatedPersonAccountId(personAccountId); lc.setOpportunityId(opportunityId); lc.setSendNotificationEmail(false); LeadStatus convertStatus = [SELECT                   ...

Read More

Top Apex Features From Spring 21

Spring 21 is bringing a couple of Apex features that can be definitely helpful. This post will cover a few of my favorite Apex features from Spring 21.You can find all my Spring 21 release posts here.Feature #1With Spring 21, we can fetch the entire custom metadata records or a single record from the custom metadata. So no more SOQL query to fetch custom metadata records. Here is the video where I have explained the feature. With getAll() method, now we can get the entire custom metadata records. Here is the small code snippetpublic static void fetchAllMetadata() {    Map<String, Country__mdt> allCountries = Country__mdt.getAll();    System.Debug(‘allCountries Size: ‘ + allCountries.size());    for(String countrName : allCountries.keySet()){        System.Debug(‘Country Name: ‘ + countryName + ‘ Capital: ‘             + allCountries.get(countrName).Capital__c);    }}With getInstance( recordId ),  getInstance( qualifiedApiName ), getInstance( developerName ) method, now we can get the single custom metadata record. Here is the small code snippetpublic static void fetchCapital(String countryName) {    Country__mdt singleCountry = Country__mdt.getInstance(countryName);    System.Debug(‘Country Name: ‘ + countryName + ‘ Capital: ‘         + singleCountry?.Capital__c);}Feature #2With Spring 21, we can now convert 18-character Id to 15-character Id. Here is the video where I have explained the feature. With to15() method, now we can get the 15-character Id of the corresponding 18-character Id. Here is the small code snippet.public static void convertId(String id_18) {    ID test18 = id_18;    System.Debug(’15 Digit ID: ‘...

Read More

How to Run part of the Flow after the Triggering Event | Spring 21 New Feature

If you are a Salesforce Flow fan, I am sure like me, Spring 21 release is going to excite you as well. If you are dealing with situations where you need to take actions based on some future dates, till today, you can either write scheduled action in Process Builder or time-dependent actions in workflow rules. But with Spring 21 release you can implement the same in flow. This post will show you how you can take advantage of this new cool feature. I also created a video explaining the steps.You can check my other posts which talk about some of the flow enhancements that are coming along with Spring 21 release.How to compare between Prior and New Value in Record Triggered FlowsBlog:  http://bit.ly/3r78BToVideo:  https://youtu.be/auTFTb2exhwHow to create multi-column screens in Flow BuilderBlog: http://bit.ly/38ta5i6Video: https://youtu.be/CiKf5bVdGqwUse Case:Here is the use case which I will be implementing -Step 1Create a Record-Trigerred Flow and choose Freeform/Auto-Layout in the next screen. Step 2Configure the Trigger Screen as -Trigger the Flow When: A record is created or updatedRun the Flow: After the record is saved [Note – Schedule action/path is only available after the record is saved.]Step 3Configure the object as “Opportunity” with the criteria to make sure flow is running only when the opportunity is open.Important – Select “Only when a record is updated to meet the condition requirements” under the “When to run the Flow for updated records”...

Read More
Loading