Posts

Showing posts from May, 2024

Salesforce Fact #840 | Platform Event publish limit

Platform events configured with 'Publish Immediately' behavior are counted against a separate publishing limit of 150 EventBus.publish() calls. It can be checked by issuing a Limits. getPublishImmediateDML() method call. Whereas platform events which are configured with 'Publish After Commit' behavior are counted against the DML statement governor limit. It can be checked issuing a Limits.getDMLStatements() call. Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_eventbus.htm#apex_System_eventbus_publish

Salesforce Fact #839 | MasterRecordId in merge

Image
There is a field 'MasterRecordId' present in Account, Contact, Lead and Case object which is used in the merge operation. During the merge operation, one master record and additionally upto two same sobject records can be specified. Once the merge is completed, the merge record is deleted and the MasterRecordId field is populated with the corresponding master record Id. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_account.htm Attached is a sample screenshot.

Salesforce Fact #838 | Database.querywithBinds() usage

With the new Database.querywithBinds() method, we can use bind variables as map of String, Object. It also supports multiple values, and even works with list of Sobject. Reference:  https://salesforce.stackexchange.com/questions/397098/dynamically-pass-bind-variables-to-a-soql-query-with-querywithbinds-method Below are the code samples: //works with list of String Map<String, object> bindVars = new Map<String, Object>(); bindVars.put('accNames', new List<String>{'Test Acc1', 'Test Acc2', 'Test Acc3'}); String query = 'SELECT Id, Name, Rating FROM Account WHERE Name IN :accNames'; List<Account> accList = Database.queryWithBinds(query, bindVars, AccessLevel.USER_MODE); //works with list of Sobject as well List<Account> accList1 = [SELECT Id FROM Account WHERE Id                           IN ('0016F00002RrZdsQAF', '0016F00002RrZdtQAF', '0016F00002RrZduQAF')]; Map<String, object> bindVars =

Salesforce Fact #837 | Address copy in screen flow

Image
In most of the forms we fill in, there is an option to copy the current address details to permanent address on selecting a checkbox. Why not implement the same in screen flow? Thanks to reactive components and a bit of formula logic. Attached are the screenshots.

Salesforce Fact #836 | UNDELETE_FAILED

Image
Similar to ENTITY_IS_DELETED error, if we attempt to undelete a record from recycle bin by mistake which has already been hard deleted, the following error is encountered: UNDELETE_FAILED. Attached is one sample screenshot.

Salesforce Fact #835 | Multiple TYPEOF in SOQL query

We can have multiple TYPEOF clause in SOQL query. Example: SELECT     TYPEOF What         WHEN Account THEN Phone         ELSE Name     END,     TYPEOF Who         WHEN Contact THEN Email         ELSE Phone     END  FROM Task