<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shashank Singla on Medium]]></title>
        <description><![CDATA[Stories by Shashank Singla on Medium]]></description>
        <link>https://medium.com/@shashanksingla?source=rss-ab54f15b44e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lXWynfWfuADjjbZH09CJ3A.jpeg</url>
            <title>Stories by Shashank Singla on Medium</title>
            <link>https://medium.com/@shashanksingla?source=rss-ab54f15b44e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 17:05:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shashanksingla/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Salesforce’s Record Type & Picklist Matrix]]></title>
            <link>https://medium.com/@shashanksingla/salesforces-record-type-picklist-matrix-a112429c8150?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a112429c8150</guid>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[salesforce-productivity]]></category>
            <category><![CDATA[salesforce-tools]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Tue, 02 Aug 2022 16:37:48 GMT</pubDate>
            <atom:updated>2022-08-02T16:40:25.694Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you Familiar with field dependencies in Salesforce where you can visualize the dependent values among two fields with a beautiful matrix being present in the system ??</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkKGYfhU83VzL2BkzpvPBw.png" /><figcaption>Sample Matrix of a field Dependency</figcaption></figure><p>In a Similar way when it comes to picklist values of a field that are tied up to a specific SObject with multiple record types, I could not find any such button so that one fine day</p><ul><li>if an Admin User needs to back track what all picklist values of a Picklist/Multi Select field are being assigned to each record type then that is a hectic task to navigate to each record type and field and then to map the values into your brain or an Excel file.</li><li>It is not a pleasant way to visualize specially for business users if there are many record type and they need to reassign values</li></ul><p>so I have created a small utility which can help you with this information in fewer clicks.</p><p>🎉 <strong><em>Ta-Da , presenting RecordType — Picklist Matrix </em></strong>🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bhQHJxd1NuE_sg6K03DoPQ.gif" /></figure><blockquote>Is it worth trying?</blockquote><ul><li>Until Salesforce provides a button for this :)</li><li>It will save a lot of time and its quite handy to use.</li><li>its an <em>Org-independent LWC component </em>which means sobjects specific to target org will show up for you to select when you access the component, simply refer the <a href="https://github.com/ShashankSingla001/Picklist_RecordType_Matrix"><strong><em>repository </em></strong></a>, deploy it and start using it on your App Page or Record Page or as a Tab,</li><li>leverage the option to copy the JSON mapping which can be used for internal purpose (this was useful for me in a real scenario so I kept this feature intact.)</li></ul><p><em>please let me know if it helped you or if any suggestions you have to make it better.</em></p><p><em>Thanks for Stopping by …</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a112429c8150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Package.xml Creator in LWC]]></title>
            <link>https://medium.com/@shashanksingla/package-xml-creator-in-lwc-bfddad49519e?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfddad49519e</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[lightning-web-component]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-productivity]]></category>
            <category><![CDATA[metadata]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Thu, 01 Oct 2020 19:31:40 GMT</pubDate>
            <atom:updated>2020-10-02T14:33:47.627Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>&lt;##Salesforce##Package.xml ##Metadata Components##Lightning Web Component</em></strong><em>##&gt;</em></blockquote><p>Deployment is an integral part of the development that needs to be fast and efficient to address solutions to the actual problems rather than focusing on the problems faced during its deliverability.</p><p>With this Focus in mind and Getting my hands on Lightning Web Components, I created this small solution to Fastrack a step of the deployment which is package creation, Package creation could be time taking when a list of the specific component needs to be deployed. although there are some extensions to help you with that also so this could be an add-on to that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7uwFbmdrrLJ0o8VAvBdYVA.gif" /><figcaption>Quick View of the Metadata Fetcher Component</figcaption></figure><p><strong>Features of the Component Includes: -</strong></p><p>— <strong>List All Metadata Items</strong>: Fetch The list of All Metadata Items At Once of the Configured Org as Each Org has its own set of Metadata Items<br> — <strong>Refresh Metadata Index</strong>:- Created a New Field? please don’t bother to refresh the Page of this Component, if Opened just refresh the metadata Index from the component itself and the Newly Added field will appear when Its Metadata Option is Explored.</p><p><strong>— Narrow Down Your results by search: </strong>works for both Metadata Items and its respective Components.</p><p>— <strong>Multiple searches of metadata components: I</strong>f you have a list of FLexipages to Select, No need to type each then select and repeat, just put all Flexipages Name comma Separated and you will get a Filtered List. (do Cross Check).</p><p>— <strong>Multi-Select</strong>:- Thanks to <strong>For Loop</strong> for Existing.<br> — <strong>Preview XML Side by Side:-</strong> As you select any Component Xml will update in real-time.</p><p>— <strong>Copy XML:-</strong> You can Copy the XML to Your Clipboard directly<br> — <strong>Export your Package:</strong> Download the Package and Good Luck with your Deployment.</p><p>— <strong>Version for Package</strong>:- I have given a design Attribute for you to configure version No for the package in Lightning App Builder, Currently having versions <strong>[47.0,48.0,49.0]</strong>. You can add Future versions by configuring them in <strong>metadataSelectorAdvanced.js-meta.xml</strong> File</p><blockquote><strong>Einstein Analytics Relevant Gem:- </strong>An Observation for Einstein Analytics Specific Feature that <strong>WaveXmd</strong> Files are relevant to <strong>WaveDashboard</strong> and <strong>WaveDataSet</strong> but when all XMD’s are retrieved using a wildcard(*) Dashboard’s XMD’s are skipped(reason not known to me). so to cover that mile u. Select any Dashboard and its Xmd will Follow up in this Package itself.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10zk7owmelgMx6V9WzbymA.gif" /><figcaption>Multi-Search Feature in the Component.</figcaption></figure><p>I have Used Metadata API to get the Metadata Items also Concerning some Special Cases Like <strong>Document, Report, Email Template</strong> where <strong>fullName </strong>is not returned directly through API(I have Used SOQL to get the same). The component will consume a full set of API limits if all Components are selected so discretion is Required Beforehand. The component is Namespace Proof so it will include all those components having Namespace too.</p><p>To use the component in your org deploy the Source Code From the below-mentioned Link. The steps are mentioned there.</p><p><a href="https://github.com/devshashank/Salesforce-Package.xml-Creator"><strong><em>Click here to See Source Code</em></strong></a></p><blockquote>Developing this component was fun and a bit challenging. I will be working on its Version upgrade soon but it’s a good Headstart till then. do let me know if it helps you in some sort of way or if any suggestion could make it better.</blockquote><blockquote>Thanks for Stopping by …</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfddad49519e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhanced Related Lists]]></title>
            <link>https://medium.com/@shashanksingla/enhanced-related-lists-3266ab82cb33?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3266ab82cb33</guid>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[aura]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[salesforce-productivity]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Sat, 25 Apr 2020 23:16:10 GMT</pubDate>
            <atom:updated>2020-04-25T23:18:49.271Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>&lt;##<strong>Salesforce</strong>##<strong>Related Lists</strong> ##<strong>Junction Object Records</strong>## <strong>Lightning</strong>&gt;</blockquote><p>When It comes to show Related Object Records in Salesforce Record Page there is nothing much you can do about any relevant data that you want to see in Related List with the standard Related Lists of Salesforce. let’s hit the Business Use Case(<strong>Hypothetical</strong>)</p><p><strong>Scenario 1:</strong> If a Support Engineer belongs to a Support Team(Account) and He/She wants to see and Modify the Cases Under his/her Team then he has to Navigate to Account First then will be able to see the records for the same(with Appropriate Access only).</p><p><strong>Scenario 2: </strong>Your Contact under a Company(Account) needs to see what other Contacts does it have to Communicate with Under the Same Company. (<strong>Records of junction object</strong>).</p><p>So these kinds of scenarios have been addressed by the Lightning Component I recently developed and it has some cool features that could be Used &amp; can be extended too.</p><blockquote>Features Include :-</blockquote><ul><li>The important Catch here is the <strong>“Title”</strong>, Yes It is Configurable.</li><li>Can show current page Object related records also just like salesforce does <strong>inclusive of their parent fields </strong>to showcase if required.</li><li>If you have Linked your Contacts/Accounts/Leads to Social (Twitter, Youtube), you can see the images in the related list in <strong>bubble form</strong>.</li><li>All the standard/custom objects whose tab Exists will get their <strong>Icon displayed</strong> in the related list(default is <strong>action:freeze_user</strong>)</li><li>You can give Any External Image through URL to showcase as Icon in Related List.</li><li>you can show any list of record related/non-related to the current record page and can give Own Title to the related list</li><li>Collapsible/Expandable Section of Related List on Header Click and the default behavior is Configurable.</li><li>It has three default<strong> New/Delete/Edit</strong> Button with related records.</li><li>You can configure how many records you want to show initially to save up space.</li><li>You can configure the display of icon with records(show it or not).</li></ul><blockquote><strong>Brief Setup Instructions</strong></blockquote><p>you can get the repository directly from <a href="https://github.com/devshashank/Enhanced-Related-Lists">here</a> <em>and move it to your sandbox/Dev Org. </em>Once you deploy it, you Should see the <strong>RelatedList</strong> component in the lightning App Page builder.</p><p>Drag it to the desired position and click on it, you need to set the required Attributes on the right-hand section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*qav5SR6j4qpy6MNzVZSO8g.png" /><figcaption><strong>Relatedlist Component Setup</strong></figcaption></figure><ul><li><strong>Title</strong>: The Title of Related List that You Want to show at Header.</li><li><strong>Query</strong>: you need to mention the query to fetch the records as per the guidelines given Above</li><li><strong>Image URL</strong>: you can specify any image URL to showcase in the icon place of the Object as well as a Record list</li><li><strong>Expanded</strong>: What do you want your default view of the List on Load (Expanded/Collapsed)</li><li><strong>Show Icon</strong>: If you want to Hide the icon/Image on the records List you can unmark it</li><li><strong>Records To Show Initially</strong>: Figure it out!!</li></ul><blockquote><strong>Not getting it, What This Data will Yield To?? Exactly!!</strong></blockquote><p>Below Are two different use of the Same component showing indirectly related data Of Case in its related Section(<strong>Covering Both the mentioned Scenarios</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*47syWXQQfdps2gJS27bv7w.png" /><figcaption><strong>Case with Related Cases and Contacts Via Parent Account</strong></figcaption></figure><blockquote>Want to try it? Go ahead &amp; get started with this already</blockquote><p>put <strong>relatedlist</strong> Lightning Component at <strong>Contact Record Page</strong>, let’s get the related Contacts with the same Account using the component</p><ul><li><strong>Title</strong>: Colleagues</li><li><strong>Query</strong>: <strong>SELECT Id, Name,CreatedBy.Name FROM Contact WHERE AccountId=’&lt;&lt;AccountId&gt;&gt;’</strong></li><li><strong>Image URL</strong>: upto you, Could be Your Quarantine Picture!!</li><li><strong>Expanded</strong>: true</li><li><strong>Show Icon</strong>: true</li><li><strong>Records To Show Initially</strong>: Keep it 6</li></ul><p>you will get the insight of how to make your own query for the same <a href="https://github.com/devshashank/Enhanced-Related-Lists/blob/master/README.md">here</a></p><p>I have kept it Open Sourced so please go Ahead and Expand it further if it can help you and do give me a heads up you found it helpful or if any further help is required to understand the same. Thanks :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3266ab82cb33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send Emails from Salesforce using Email Service Address.]]></title>
            <link>https://medium.com/@shashanksingla/send-emails-from-salesforce-using-email-service-address-392b291b0111?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/392b291b0111</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-productivity]]></category>
            <category><![CDATA[salesforce-lightning]]></category>
            <category><![CDATA[salesforce-developer]]></category>
            <category><![CDATA[salesforce-email-list]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Wed, 08 Apr 2020 17:30:26 GMT</pubDate>
            <atom:updated>2020-04-08T18:20:44.675Z</atom:updated>
            <content:encoded><![CDATA[<h3>Send Email from Email Service Address.</h3><p>This was quite a unique yet exciting problem i came across while developing solution for a Business Use Case.</p><p>So if you want to send email from Salesforce, we can use Workflow/Process builder/ Apex . That is fine but the <strong>From Address </strong>in the email using the utilities or Apex can only be set with current User’s Context Email or Organization-wide-Addresses or Default workflow User’s Email Address.</p><p>Two Points to Consider here.</p><ol><li>Every Org wide Address Email should be verified.</li><li>If you want to Handle reply from the sent mail using <strong>InboundEmail</strong> Class also then you need to use <strong>Email Services Address </strong>in the<strong> ReplyTo() </strong>or <strong>From Email Address</strong>.</li></ol><p>Now for us to send and receive Email from and to Email Service Address this is what could be done to achieve the same.</p><ol><li><strong>Create an Email Service Address and activate it :</strong></li></ol><p><em>(An Apex class is mandate to handle incoming Mails from the Addresses in this Email Service but we can generate multiple address against this service and assign diff. Context Users to it)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HjR5PlLpAtp1bf0IZMAZHw.png" /><figcaption>Demo Email Service (<strong> You can create one via Setup&gt;Build&gt;Develop&gt;Email Services</strong>)</figcaption></figure><p>2. Add the context user of the email service to Debug Log Monitored Users under <strong>Setup -&gt; Monitor -&gt; Logs -&gt; Debug Logs</strong></p><p>3. Now Add the generated Email Service email as an Organization-wide Address under <strong>Setup -&gt; Administer -&gt; Email Administration -&gt; Organization-Wide Addresses.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYq4omtJb4yK-572svbJ9w.png" /><figcaption>Org Wide Email Address yet to be verified</figcaption></figure><p>4. Go back to the Debug Logs page and find the log with the operation EmailToApexHandler. Search for “<strong>Click this link to confirm this Organization-Wide Email Address: </strong>“ and copy and paste the following link into another browser window, your email service address will now be verified.if you couldn’t find the debug log at first then you can generate it again by clicking on Resend button</p><p>Now that your Email Service Address is verified in the Org Wide Email Address, you can use it in Utilities/Apex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VdSu4c0ZBmLSl4ef2djGbA.png" /><figcaption>Code Snippet for Triggering Mail from Apex to Respected User From Email Service Address.</figcaption></figure><p>This was it, Though the solution is a complete workaround as far as verifying the org-wide Address is Concerned but till Salesforce Figures it out in future releases. it’s good to stick by this solution. please do consider the permissions of the context user while processing Incoming Emails using <strong>With Sharing </strong>keyword in apex class to maintain data integrity and do reach out to me for any clarification regarding the same. I hope to help as many people by posting frequent. Any Suggestions are welcomed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=392b291b0111" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Junction Object Access based on Master Object Access On Profiles.]]></title>
            <link>https://medium.com/@shashanksingla/junction-object-access-based-on-master-object-access-on-profiles-deab3d09cedd?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/deab3d09cedd</guid>
            <category><![CDATA[salesforce-tools]]></category>
            <category><![CDATA[master-detail]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[objects]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 18:41:42 GMT</pubDate>
            <atom:updated>2019-12-16T18:44:03.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Junction Object Access in Salesforce</h3><p>As Master-Detail Relationships are truly Amazing in their own functionality like <strong>Cascade Detail Record Deletion</strong> and <strong>Roll-Up Summaries</strong>, it is stated that the Detail Object Always Inherits the sharing Permissions of the Master Object so we can <strong>control </strong>the Enforcement of <strong>Detail Object Permissions </strong>based on <strong>Master Object Level Permissions</strong> in a profile. we have two Permissions Available While Declaring a Master-Detail Relationship which is very important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSHyqCl8UW86tucNHJv4UA.png" /><figcaption>Sharing Setting Option While Creating A Master-Detail Relationship</figcaption></figure><p>now there comes two scenarios :</p><p>1.If An Object Has only <strong>One Master-Detail Relationship</strong> defined then according to the above-selected Permission setting the detail Record CRUD options will be made available. This kind of Relationship is<strong> One-to-Many </strong>Kind of relationship.</p><blockquote>for Instance, <strong>Read/Only </strong>Access <strong>Sharing Setting is </strong>Enabled for Detail object and <strong>Detail </strong>Record have <strong>All the Access</strong> (Read/Create/Edit/delete/View All /Modify All) for the <strong>detail </strong>object and <strong>Master object </strong>has <strong>No Access</strong> to <strong>Read/Create/Edit Master Object </strong>then that particular profile user will not be able to see/Create/Edit Detail Record and will not even able to see the Tab for detail records (if Created). and <strong>if Atleast Read access</strong> is there on the master object then the detail object permissions will be applicable to that profile.</blockquote><p>2. If An Object Has <strong>Two Master-Detail</strong> Relationship defined then according to the above-selected Permission setting the detail Record CRUD options will be made available.<strong> </strong>This kind of Object is called<strong> Junction Object </strong>and it provides<strong> Many-to-Many </strong>Functionality.</p><p><strong>what will happen if one master object has minimum permissions required and the second master object does not have minimum permission required for Sharing Setting??</strong></p><blockquote>for Instance, <strong>Read/Only </strong>Access <strong>Sharing Setting is </strong>Enabled for Detail object of Both Master Object. and Detail object has all permissions (Read/Create/Edit/delete/View All /Modify All) and.</blockquote><blockquote>first master object has no access at all against that object,but second master has read access against that object on profile.</blockquote><blockquote>then detail object will not be accessible to this profile user for any CRUD Operations as here most Restrcitve permission will win and minimum read only access is required on both the Master objects for Applying CRUD level Permissions of detail object on that particular Profile.</blockquote><p>now for the second kind of Sharing Setting option which is <strong>Read/Write. </strong>It&#39;s just that the same rule will apply like the above-mentioned scenarios with just at least Read/Write Permission over <strong>each Master-Detail Object at specific profile level to Enforce Object Level Permissions of Detail Object.</strong></p><p>This scenario was a very important bottleneck faced by me in one of the functionality to work out,I would love to share and explore more use cases sooner. maybe there could be better solutions or a new path in future Salesforce releases regarding the use cases discussed above so please do explore your options before relying directly on this. The intent is just to share and aware. Thanks for stopping by.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deab3d09cedd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Platform Events Record Locking Issue.]]></title>
            <link>https://medium.com/@shashanksingla/platform-events-record-locking-issue-959406e9d7eb?source=rss-ab54f15b44e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/959406e9d7eb</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[apex]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[event-platform]]></category>
            <dc:creator><![CDATA[Shashank Singla]]></dc:creator>
            <pubDate>Tue, 01 Oct 2019 19:55:55 GMT</pubDate>
            <atom:updated>2019-10-01T19:55:55.615Z</atom:updated>
            <content:encoded><![CDATA[<p>Platform Events are magical when it comes to Integrate salesforce system with third party systems in order to receive information and also gives a flexibility to us to handle the incoming data which is just a snapshot (we just need to capture it,process it and it will vanish right away). with every release its getting stronger and stronger like being moved to High Volume from Standard volume so that it can process millions of records or being used to process batch failures through standard platform Event(<strong>BatchApexErrorEvent</strong>).</p><p>One Interesting yet crucial Use Case came into Picture when I was working on Triggers on Platform Event Object. there was a scenario where a third party system was publishing the event and being the subscriber of that Event,the trigger was processing the record and was updating a salesforce object but at the same time a Salesforce User was working on the same Record so, update through platform event was not able to obtain the exclusive lock on the record and the transaction was failing. this was the anomaly where events being asynchronous was not helping as we cannot bound a user to work/proceed until third party sends us the data or vice versa as per the requirement. now to overcome this issue the following options helped me a lot :</p><p><em>&lt;/&gt;Reducing the Execution Time is also a good solution to avoid </em><strong>ROW_LOCK </strong><em>Issues. The approach is </em><strong><em>Divide and Conquer. </em></strong><em>we can shadow somewhat like </em><strong><em>multithreading </em></strong><em>by creating multiple triggers of platform event object and filter (mostly using string manipulation) the records based on ReplayId (Unique Always) ex. Last digit ,say two triggers for odd and even digits, so it will reduce the batch size by half and will increase the efficiency by 50% and fast processing will definitely save us some golden milliseconds from our record to get stuck in row lock situation, provided the record updates involved in each event should be independent and data inconsistency is not the risk to be taken here.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iLqyNMocOY3sOJB68h_g0w.png" /><figcaption>Filtration of events based on Replay Id</figcaption></figure><p><strong><em>&lt;/&gt;</em></strong><em>If you are updating other Salesforce object records in Apex Trigger of platform event then we should use Database.Insert() or Database.Update() as if one record fails then rest of the records are good to go. now what do we do with the records which are failed due to row lock??? Either we can sit and wait for record to get free which is not an option even in asynchronous Transaction or we can retry to an extent just to win the battle of shipping the data which is the gold here. so with hopes of victory we can follow below mentioned approach</em></p><p><em>&lt;/&gt; you can filter the event records with Insert/Update issues, specifically the error of record lock issue(</em><strong>UNABLE_TO_LOCK_ROW</strong><em>) using </em><strong>isSuccess() </strong>method of<strong> Database.SaveResult </strong>class <em>and create a new instance of those events and can publish the same but also keep the count on an event field so that it gets increment every time you republish and check the count in trigger itself so as to avoid any looping situation.</em></p><p>&lt;/&gt; <em>if you do not wish to commit records DML partially using Database.Insert/Database.Update and want to handle the error scenario then in that case if one records face this issue the whole batch of event’s update will rollback and you can </em><strong><em>throw </em>EventBus.RetryableException</strong><em> which try to republish the whole batch of events upto 10 times which you can also configure to limit.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRIJ3r3DSRSzy8ELPtf0ew.png" /><figcaption>Retryable Exception Throw logic when Event Execution Fails</figcaption></figure><p>Clearly this was one of the best Use cases that I’ve worked upon in Salesforce Development and there could be more bottlenecks depending on the complexity of the business and the processes setup for the same.I would love to share and explore more use cases sooner. maybe there could be better solutions or a new path in future Salesforce releases to overcome this issue so please do explore your options before relying directly on this. The intent is just to share and aware. Thanks for Stopping by.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=959406e9d7eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>