<?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 Prajeet Gadekar on Medium]]></title>
        <description><![CDATA[Stories by Prajeet Gadekar on Medium]]></description>
        <link>https://medium.com/@prajeetgadekar?source=rss-b7e805b7f419------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AawsB0G7O-m7hFbX</url>
            <title>Stories by Prajeet Gadekar on Medium</title>
            <link>https://medium.com/@prajeetgadekar?source=rss-b7e805b7f419------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 16:36:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prajeetgadekar/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 Identity — SAML based SSO]]></title>
            <link>https://medium.com/@prajeetgadekar/salesforce-identity-saml-based-sso-e0d037705605?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0d037705605</guid>
            <category><![CDATA[salesforce-tools]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-productivity]]></category>
            <category><![CDATA[single-sign-on]]></category>
            <category><![CDATA[aml]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Sun, 30 Jul 2023 14:55:49 GMT</pubDate>
            <atom:updated>2023-07-30T14:55:49.607Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce Identity — SAML based SSO</h3><p>SAML is an acronym for Security Markup Language. It defines a open standard for passing authentication information in a particular format between two parties, usually and Identity Provider (IDP) and an application (Service Provider or SP)</p><p>The tech industry created this XML based standard so a user can navigate from one web app to another without having to maintain separate credentials for each application. Prior to the SAML days this was only possible for apps within the same domain as they relied on cookies.</p><p>At the very core of this concept is trust. There is a trusted relationship between SP’s (applications) and the Identity Provider (IDP). The SP’s will rely on the IDP to make the decision from them. When a user requests access to an application, the first thing the app will do is check if the user already has a running session on the app, if so then great, the user just gets the access. If the user does not have an ongoing session the application will generate a SAML request for the IDP. The user will then be authenticated by the IDP, perhaps their credentials could be validated against an Identity store. The IDP could also challenge the user and ask them to go through a second form of authentication (MFA). Once it has completed all the checks it is supposed to, the IDP will generate an assertion. This is where trust plays a role. The application or the SP trusts the assertion. Trust needs to be secure so there are certificates involved in signing the request and encoding to establish this trust (more on that later).. The SAML assertion identifies the user that is then matched by the SP to identify a user in the application and access is granted to the user.</p><p>Here is the SP initiated flow that we just described.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*OB5bPWMV4dW_D9Ma" /></figure><p>A more simpler but similar flow is the IDP initiated flow. In this flow the user authenticates himself with the IDP and then clicks on a link to log in to the application. The flow is initiated by the IDP so there is no need to send the SAML request to the IDP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*2MgNefuDf5x12ku8" /></figure><p>Coming back to Salesforce, note that in this article we are talking about Salesforce as the SP but Salesforce can also the IDP, generate assertions, receive SAML requests and let users access other applications with their Salesforce credentials.</p><h4>SAML Setup in Salesforce</h4><p>It is best to start this discussion by understanding some key definitions/concepts involved in setting up a SAML SSO.</p><p><strong>Issuer</strong> : The unique identifier of the identity provider</p><p><strong>Entity ID</strong> : Unique URL that identifies who the SAML assertion is intended for, essentially the SP. Note that both the issuer and entity id values in the SAML assertion has to match the values in the settings in Salesforce and the IDP. So unless it does match we are going to get an error. Specifically the Audience attribute in the SAML has to match entity ID on the SSO settings page.</p><p><strong>Subject</strong> : The nameidentifier element in the Subject statement will specify the user. Most common is for the SAML User ID type to be Dalesforce User objects federationID. You need to make sure you have this same value in the Federation id field of your User Object. It could be an email or something like an employee id of an organization. This is the primary mechanism to map users between the IDP and your Salesforce org. There are alternate attributes in which you can specify the user, and how it relates to Salesforce, Salesforce username is one of them but it’s unusual to expect your IDP to know the Salesforce user name. This is how subject looks like when using federationID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yfUP1Vxu7ai8ZzulDoPYyQ.png" /></figure><p><strong>IDP’s authentication certificate</strong> : Remember the assertion is signed. So your IDP is going to use a private key that no one else has, to sign the request. If you want to validate the signature, the IDP will provide a public key to all its recipients. This public key is stored in salesforce and referred to in the SAML settings. This certificate is the primary mechanism to establish trust between the IDP and Salesforce. If Salesforce is able to validate the signature with the public key it knows that the assertions could only have come from the IDP because no one else has the private key for that signature.</p><p><strong>Assertion Decryption Certificate</strong>: The contents of the assertion, that is the user’s information etc can be encrypted by the IDP. So they are essentially encrypting with the public key and they will give the private key to decrypt the content to only parties that they want to decrypt the content. So essentially the IDP will provide a Salesforce with the private key that will be uploaded in the settings as a decryption certificate.</p><p><strong>Request signing Certificate</strong>: When Salesforce does not have a session and generates a SAML request to be sent to the IDP, that request can be signed. It has to be signed by a private key, so this cert represents the private key to signing the request. For the SP initiated flow we will have to provide a public key to the IDP so they can validate the signature.</p><p><strong>Request binding</strong> : Based on the preference of your IDP the SAML request could either be a HTTP POST sending a SAML message using a bse64-encoded HTML form OR a HTTP Redirect sending a base64-encoded and URL encoded SAML messages with URL parameters.</p><p><strong>Single Logout</strong>: If the desire is to log out of all applications that the IDP supports when they click login out of any one application, generally a chaining mechanism is used. In Salesforce we specify a URL to redirect after the Salesforce session is logged out. This URL could point to the IDP single logout mechanism which can make sure every application’s logout method is invoked.</p><p><strong>Just in Time</strong>: If we want to provision users in real time when they try to login for the first time or update the user record when they login the concept of just in time provisioning can be used. IT consists of a JIT Handler apex class that has the logic to create the user. Note that JIT is useless when it comes to deprovisioning.</p><p><strong>Identity Provider Login URL : </strong>This is where Salesforce or the Service provider will redirect when there is not active session and needs IDP’s intervention.</p><p><strong>ACS URL’s</strong> : This is where the IDP will redirect with the assertion. The SAML request usually sends the ACS URL to the IDP. A list of ACS URL’s are also added to the IDP’s settings, a request cannot have an ACS URL that is not already in the IDP settings. When the SAML setting is saved in Salesforce ACS URLs for core and any experience sites are generated.</p><p><strong>RelayState parameter</strong>: It’s an important parameter that stores the exact resource location within the SP. You generally do not have to deal with it until you are doing something custom in your solution like posting/redirecting a request to a custom endpoint instead of the IDP directly. Your solution will have to make sure it keeps propagating the relaystate so the exact resource on the SP can be reached when the assertion is posted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vB_64QXMO0HsRNXr" /></figure><p>We spoke through most of what you could do in the Salesforce settings. ACS URLs are generated when the settings are saved.</p><p>You can have multiple SSO settings in Salesforce including multiple SAML setups.</p><p>On the mydomain’s page you can select which SSO types are shown as options to users on the orgs Salesforce login page. For experience cloud providers can be selected on the Login and Registrations tab within the experience cloud Administration screens.</p><p>Salesforce has the SAML assertion validator page that can help validate assertions so exact errors can be conveyed to the IDP.</p><p>AD FS which provides a federated service, aka ability to generate the SAML assertion, in an organization that relies on AD, is a common method to enable SAML for a Salesforce org.</p><p>That is everything about the SAML, let’s talk about OIDC in the next article in this SSO series. To to back to the basics go to Salesforce Identity Basics <a href="https://medium.com/@prajeetgadekar/salesforce-identity-the-basics-e453e8efc65d">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0d037705605" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce Identity — the basics]]></title>
            <link>https://medium.com/@prajeetgadekar/salesforce-identity-the-basics-e453e8efc65d?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/e453e8efc65d</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[single-sign-on]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-tools]]></category>
            <category><![CDATA[identity-management]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Sat, 22 Jul 2023 19:23:10 GMT</pubDate>
            <atom:updated>2023-07-22T19:23:10.475Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce Identity — the basics</h3><p>Salesforce identity is a very vast topic so here we will focus on very typical identity related requirements and their Solutions that we have to deal with as architects on Enterprise level Salesforce implementations. The first question on identity is are end users allowed to login into Salesforce with their Salesforce credentials? The answer to that question in a typical Enterprise is a No. A lot of your clients could be using Active Directory as their identity store and some services like ADFS or perhaps an identity provider like say pingIdentity to actually provide the identity services.</p><p>Although this is not the only use case when you will have to deal with identity. There are many other use case:</p><ul><li>How do user log in to experience cloud</li><li>How does a user get access to a record page in salesforce when they get a link in an email sent to them.</li><li>How do we authorize external applications who want to call salesforce API’s and use Salesforce services</li><li>How does a Salesforce user get authorized to access services in the clients ecosystem (on premise or in the cloud)</li><li>How does a user navigate between Salesforce and other applications in the clients enterprise without ever having to sign on again.</li></ul><p>For now let’s focus on the simple how does a user login to Salesforce use case.</p><p>Here is how identity typical works, we will also understand some glossary. Let us not worry about the protocols for now, whether it’s Oauth or SAML or OIDC. (although some settings discussed here may apply more to SAML than OIDC)</p><p><strong>Service Provider</strong> : Any system that provides services to the user. Salesforce is a service provider, an experience cloud is a service provider. Although note that Salesforce can also act as an identity provider if so desired. In the OIDC world a service provider is called a Relying Party.</p><p><strong>Identity Provider</strong> : An application that can be trusted to centrally validate the authenticity of a user and let the Service provider know if its ok and at what level should be user get access to the Service provider.</p><p><strong>Identity Store</strong>: This could be AD or just a custom database that has the information about the user and their access levels that the IDP can access to determine if a user is able to access the Service provider at the level which was requested.</p><p><strong>SP Initiated flows</strong> : A SSO scenario when the request to a resource is initiated on the SP. e.g a user clicking on a link they received on an email or clicking on a favorite link they saved on a browser. In both cases the user’s browser tries to pull up the resource in the SP and determines there is no session and redirects to the IDP. In the SAML protocol a SAML request is sent to the IDP with a relay state (exact resource location within the SP).</p><p><strong>IDP Initiated flow</strong> : The user logs in to the IDP and clicks on a link to access the SP. In this case the IDP initiates the flow. In the SAML protocol a SAML assertion is generated and posted to the SP without ever needing a SAML request.</p><p><strong>Just in Time (JIT) Provisioning</strong> : Create users on the fly when they try to log in, basically validate the user does not exist already and create the user record and then log them into the session. JIT can also be used to update an existing user. The main drawback is you cannot decommission a user based on JIT and the user sync is not real time and has to wait until the user tries to log in next time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FbnsIkuI4HYT6zU8" /></figure><p>When you start thinking of the solution here are all of your considerations</p><ul><li>Where will be the identity store</li><li>Is there already an IDP that is used to log in to other applications</li><li>How will users be provisioned in Salesforce</li><li>How do we inactivate users in Salesforce</li><li>Do Salesforce profiles, permission sets, roles etc map to anything that the IDP determines.</li><li>What protocol should we be using</li><li>Can Salesforce act as an identity provider for itself and some sales or service related applications.</li><li>How do we provide multi factor authentication (Remember now it is mandatory according to Salesforce’s client contract)</li><li>Is there a requirement for a single logout ( logging out of all applications when logging out of the IDP).</li></ul><h4>Start Here</h4><p>That’s a lot of considerations. Let’s use this to figure out where you start and how you proceed to start finding answers for your implementation.</p><ol><li>Is Salesforce going to only only be a Service Provider</li><li>Are we using Delegated authentication (tap into your organizations central credential management system like an LDAP server)</li><li>If not delegated, who is going to be the IDP</li><li>What protocol will we be using (SAML vs OIDC)</li><li>Is Salesforce acting as both a service provider and IDP</li><li>If yes does salesforce have to act as an IDP for other enterprise applications (We could also be chaining IDP’s where a user logs in the Salesforce through and IDP but can log in to other apps trusting Salesforce as the IDP)</li><li>Are we going to enable multiple IDP’s (Possible to enable once IDP’s OIDC or SAML’s are set up they can be enabled for the org on the domain settings page)</li><li>Do we need to prevent login with Salesforce credentials?</li><li>User provisioning Just in Time</li><li>User de provisioning strategy (Just in Time does not work here)</li><li>If the org has Active Directory should we use Identity Connect (that can sync users between AD and Salesforce)</li><li>Does the IPD have MFA do we have to use Salesforce MFA?</li></ol><p>There is a lot that goes into determining the answers to these questions. Once we have a basic understanding of which way we are leaning, a deep dive into each approach will be needed to put together an end to end architecture for the identity management process.</p><p>But before we deep dive into protocols there are a few more basics to cover that are critical to understanding how we enable these SSO settings for users.</p><p>Since you are enabling SSO for your settings to apply to our org and not rely on login.salesforce.com you will need a domain for your Salesforce org. The settings to enable what type of login options are presented to a user are selected on the Mydomains page (for core and for experience cloud there are settings in experience cloud). Under Authentication Services you will see checkboxes for all the SAML and OIDC providers set up in the org. Uncheck login form if you want to prevent login from Salesforce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ll_avrrBghk4fYZj" /></figure><p>Ideally do not check this “prevent login from Salesforce” flag in Mydomain as you want to let admins login in directly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cn4gRLPWfaLS_GW7" /></figure><p>At the profile level check this flag for all profiles except the admin, because if your SSO is down you need your admins to be able to log in and perhaps change settings to let folks login with their credentials until the SSO issue is fixed. (Can be managed at the permission set level too instead of profiles if you have already pivoted to Permission sets in your implementation)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/0*f36jyarj9rJV94qO" /></figure><p>For admins make sure there is a MFA setup since it’s not mandatory for logging in to Salesforce.</p><h4>Whats Next</h4><p>Now it’s time to delve a little bit deeper into protocols and how things actually work in a SSO.</p><p>In the next article we will deep dive into a SSO based on SAML, followed by OIDC and then in a subsequent piece cover other use cases like calling external apps from Salesforce, how to use connected apps or how to setup salesforce as the IDP.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e453e8efc65d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce’s Event Integrations — CDC, Comparison & Practical Tips(Part III)]]></title>
            <link>https://medium.com/@prajeetgadekar/salesforces-event-integrations-cdc-comparison-practical-tips-part-iii-a1ebf1eb910?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ebf1eb910</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-integration]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 18:46:34 GMT</pubDate>
            <atom:updated>2023-06-25T18:46:34.713Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce’s Event Integrations — CDC, Comparison &amp; Practical Tips(Part III)</h3><p>We have already seen how <a href="https://medium.com/@prajeetgadekar/salesforces-event-integrations-pushtopics-part-i-962e48682944">PushTopics</a> and <a href="https://medium.com/@prajeetgadekar/salesforces-event-integrations-platform-events-part-ii-3984b5a3aaf3">Platform Events</a> work, in this third part we will focus on Change Data Capture and how they compare to Platform Events and some practical tips as you get ready to dive in to design.</p><h3>Change Data Capture</h3><p>Change Data Capture are platform events that are published automatically by salesforce, based on changes to underlying data. The most common use case is real-time data replication establishing a continuous synchronization of new and updated data to the external system.</p><p>CDC events generate notifications of Salesforce record changes, including Create, Update, Delete and Undelete Operations.</p><p>Change events support most standard and all custom objects. CDC can be added to the default standard channel by simply selecting the entities (Objects)) you are interested in. Metadata API and Tooling API can also be used to create and retrieve object event selections for the default standard or even a custom channel.</p><h3>Message Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KygxMvD0Z_L7ieDb.png" /></figure><p>Note that the recordID is in the header, the body is only meant for other fields.</p><p>There are cases like bulk updates when one event will have a list of recordID’s e.g mass update of a field or mass Delete on an object. There are exceptions to how recordID’s are represented in this field when exceptional events occur, e.g when you delete a field in salesforce configuration setup, there is a notification via an event and it is very unique, but let’s not get into those details for now to keep it simple.</p><p>Based on ChangeType (CRUD operation) the list of fields in the body of the message will differ.</p><p>Note that formula fields will not be included in the payload as they are placeholders and calculated realtime when accessed, on the other hand Roll up summary fields are included as they are recalculated as soon as there is a change in child records,</p><p><em>Create : The event message contains all non empty fields including system fields like created date and owner ID.</em></p><p><em>Update: Only includes the changed fields. Empty fields are included if a value was changed from non empty to empty. LastModifiedDate is included and so is LastmodifiedByID but only if the record is updated by a different user than the last save.</em></p><p><em>Delete: Empty body, the recordID of the deleted record is in the body.</em></p><p><em>Undelete: The body includes all non-empty fields from the original record as it was right before deletion. Pay load is similar to a crate.</em></p><p>The approach taken for Update and Delete presented a big challenge for enterprises that relied on an external ID to update downstream applications. This was thankfully fixed in Winter 20, you can now fix some fields to be always included in the body. (<a href="https://help.salesforce.com/s/articleView?id=release-notes.rn_change_data_capture_enrichment.htm&amp;release=222&amp;type=5">https://help.salesforce.com/s/articleView?id=release-notes.rn_change_data_capture_enrichment.htm&amp;release=222&amp;type=5</a></p><p>)</p><p>If you use pub/sub API’s for subscription the payload is more favorable in that even empty fields are included in a Create, and the update includes all fields vs only changed fields, so you can always get a full sync of the record without worrying about missed events if any.</p><h3>GAP Events</h3><p>Salesforce will sometimes send a gap event which only has the header information such as change type and record ID. It doesn’t include fields in the body.</p><p>Some common situations in which this happens is — when the message size exceeds the limit of 1 mb, some custom fields are converted to a different type or format, internal error in Salesforce or some internal cleanup like archiving of activities (tasks and calendar events) that happen a the database level not at the application server level.</p><p>A best practice on receiving a gap event is to do a call back with the record ID’s to retrieve the latest and greatest version of the record. (some gap events can be ignored on a case by case basis)</p><p>But here is a best practice on handling a Gap event:</p><p><a href="https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_replication_steps.htm#section_handle_gap_event">https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_replication_steps.htm#section_handle_gap_event</a></p><p>Gap Overflow events happen when a single transaction generates over 100k changes. For anything over 100k the system generates a gap overflow event. Here are best practices to handle overflow events in a transaction based replication approach:</p><p><a href="https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_replication_steps.htm#section_handle_overflow_event">https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/change_data_capture/cdc_replication_steps.htm#section_handle_overflow_event</a></p><p>Change Data Capture for all practical purposes are like specialized Platform Events, they have all the same properties and are treated exactly like Platform events, just that they are published automatically by the system. They also support encryption on the channel if desired.</p><h3>How do they Compare</h3><p>If you have read until this point, it’s pretty clear the only options for your consideration are Platform Events and Change Data Capture. The daily/monthly transaction limits on them fall into the same bucket, so that does not impact.</p><p>It’s really up to the use case CDC should be used for</p><ul><li>Synchronization of downstream applications or databases Near real time.</li><li>Especially useful when you have multiple downstream applications and want to ignore some events based on the origin of the change in Salesforce (if the change originated by and API by the same system)</li><li>Subscribe to mass changes in a scalable way.</li></ul><p>Platform events give you a much granular control on how and when events are published. Their payload is fully customizable.</p><h3>Licensing and Limits</h3><p>Let’s talk a little bit about the limits. Let’s first talk about limits you will likely not have to worry about for enterprise clients</p><ul><li><em>Max # of Concurrent CometD clients across all channels and all event types — 2000 for unlimited and 1000 for Enterprise editions.</em></li><li><em>Max # of Custom channels — 100 for both performance and enterprise</em></li><li><em>Max # of CDC entities — 5 for everyone (But you almost always have to buy add on licenses if you are serious about CDC)</em></li><li><em>Event Delivery — 50000 for Unlimited and 25000 for Enterprise in a 24 hour period</em></li></ul><p>The Limit on event delivery is a bummer, it includes all external subscribers whether using CometB or pub/Sub API’s, but they also include lightning components or VF using empApi.</p><p>And remember if you deliver one event to five subscribers it is counted as five deliveries. So it’s almost always a best practice to implement a hub and spoke in an enterprise where one listener is listening to Salesforce events and distributing them to everyone in the enterprise.</p><p>Table below summarizes the limits for both CDC and Platform events for an unlimited org.</p><p>Note that all of these are common limits so 50000 deliveries apply to Platform events and Change Data Capture combined.</p><p>The limit on publishing is super high, 250k/hour not per day, so you can use Platform events internally subscribing through flows, processes and triggers without worrying about limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PTlNd-j80PQIGZa_" /></figure><p>The Add-on license adds 100k additional deliveries at a time. But that’s not it. With even one add-on license, the limit is not enforced daily any more, it is enforced monthly up to a limit of 4.5M/Month. So if your business has highs and lows through the week or a month it works to your advantage. If your volumes are low on weekends, you have 4.5M for almost 22 days in a month so almost 200k/day. Another perk is the limit is now a soft limit, so if you go over in a month you will get a call from the AE to discuss your needs vs stopping your event deliveries. This license also allows you to set up CDC on as many objects as you want, removing the restriction of five objects.</p><p>The Add-on license is not very expensive and if your client is a large enterprise with a SELA with Salesforce it is usually fairly inexpensive.</p><h3>Some Practical tips &amp; Considerations</h3><ul><li>When you need related record data, try to use a platform event instead of a CDC. That will save a call back from the target to get the additional information</li><li>Field attributes are validated, so, type, length, required etc is enforced when creating a platform event so make sure your logic accounts for it.</li><li>99% of use cases are set up with “Publish After Commit”. Be wary of trying to expedite your external processes with ‘Publish Immediately”. The immediate option is asynchronous and not bound to the transaction. If you have a call back from a subscriber to query the record that was created you may find the record does not exist because it was not committed yet.</li><li>After insert trigger is also not a safe place for “Publish Immediately”, your subscriber may still receive it before record is committed in salesforce.</li><li>Change Data Capture is by default “Publish After Commit”, even if you have multiple DML’s to the same object record in a transaction there will be only one CDC event generated with the payload that is the committed state of the object at the end of the transaction.</li><li>Change Data Capture will only send the diff on fields with more than 1000 characters, so long texts etc will have to be reconstructed based on the diff and previous value.</li><li>If your target needs a payload in a specific format use a text area field in your platform event to build a JSON structure. (Either apex or Vlocity tools to convert to a JSON format)</li><li>By using only one client to subscribe to all events and using filters, your subscriptions are optimized. (a Hub to listen to events and distribute further in your enterprise)</li><li>Create a custom channel with filtered streaming if one of your subscribers needs to receive a subset of events. This way you don’t have to create a separate event for multiple use cases where events are overlapping.</li></ul><h3>In Conclusion</h3><p>Both Platform Events and Change Data Capture have a place of their own. In large enterprises you will typically see that both have been used.</p><p>This article is a good starting point to understand the lay of the land, high level features and capabilities of the event driven architecture in salesforce. This by no means is a replacement for Trailhead and Salesforce’s official documentation that continues to be comprehensive and a one stop shop for reference when it comes down to educating developers for an implementation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ebf1eb910" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce’s Event Integrations — Platform Events (Part II)]]></title>
            <link>https://medium.com/@prajeetgadekar/salesforces-event-integrations-platform-events-part-ii-3984b5a3aaf3?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/3984b5a3aaf3</guid>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-integration]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 18:29:19 GMT</pubDate>
            <atom:updated>2023-06-25T18:47:27.195Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce’s Event Integrations — Platform Events (Part II)</h3><p>We started with learning about how the events journey started in Salesforce with <a href="https://medium.com/@prajeetgadekar/salesforces-event-integrations-pushtopics-part-i-962e48682944">Generic Events and PushTopics</a>. In this second part of the three part series we are going to understand everything about Platform Events.</p><h4>Platform Events</h4><p>Platform events are secure and scalable messages that contain data. They are an improvement from generic events and PushTopics. Platform events have a predefined metadata and really opens up the possibilities with publishing and subscribing with Apex Flows API’s Etc.</p><p>We already know what an event, event message, producers and consumers are. It’s important to understand the difference between an event Channel and event Bus. An event Channel is a stream of events on which and even producers send event messages and event consumers read those messages, the channel is for a single platform event or a custom Channel that groups event messages for multiple platform events.</p><p>An event Bus is multi-tenant multi-cloud events storage and delivery service for the publish subscribe model. Event bus is based on time ordered log which ensures that event messages are stored, delivered and can be retrieved in the order they are received by Salesforce.</p><h3>Standard Platform Events</h3><p>It’s Interesting to note that Salesforce uses platform events to run the platform and these are called standard platform events. A good example would be the batch Apex error event which reports errors encountered in batch Apex job executions; you can subscribe to standard platform event streams using the subscription mechanism that the event supports.</p><p>Here is a list of all of such events</p><p><a href="https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_objects_list.htm">https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_objects_list.htm</a></p><p>Event monitoring using shield has more than fifty types of events that are supported, these are also standard platform events.</p><h3>Custom Platform Event</h3><p>These are the platform events that you are able to define and use for your use cases. You define a platform event in the same way that you would Define a custom object. giving it a name and adding custom fields. At a very high level every time a record is created in this newly defined object, you’re basically creating a platform event and all the fields that you just defined make the payload of the message for that event.</p><p>So in summary a platform event is a special kind of Salesforce entity similar in many ways to an sObject. An event message is an instance of a platform event similar to a record is an instance of a custom or standard object. but unlike a regular object you cannot update or delete event records, you also can’t view event records in the Salesforce UI.</p><p>Custom platform events can be listened to both internally and externally. Internally just think about it as any other object in salesforce, just like you can have a trigger or a flow that fires on CRUD action, a flow and trigger can also listen to an event.</p><p>From a security standpoint a user can be given permission to publish a platform event and to subscribe to a platform event.</p><p>From a transaction control perspective you can either publish an event immediately or you can publish it after the database commit, if you choose the prior you cannot roll back the published event by going to a previous setsavepoint() or rollback().</p><p>Unlike standard-volume platform events the high-volume platform events are <strong>stored for 72 hours </strong>and can be replayed using a comedD client.</p><h3>Platform Event Definition</h3><p>The definition is no different than a custom object definition except that the system appends a __e to create the API name of the event.</p><p>Two fields are critical to understand, ReplayID which is an opaque ID assigned to each message. ReplayId field value is populated by the system when the event is delivered to subscribers refers to the position of the event in the event stream.</p><p>EventUuid is a UUID that uniquely identifies a platform event message.</p><p>From the field types supported, note that a long text area is supported. If you have use cases where you need to create a complex json and send it as part of the payload to avoid a call back from the listener, that’s your field. You can use Vlocity tools like DataRaptor to transform your SOQL output into a JSON.</p><h3>Publishing a Platform Event</h3><p>From a flow, workflow or a process you can create a platform event by using the ‘Create a record’ equivalent in these tools. You are basically creating a record in the platform event object that’s all that is needed for publishing the event.</p><p>From apex it’s no different, you are taking a DML action to create a record. All salesforce API’s SOAP, REST etc that can create a record in Salesforce can also publish a platform event.</p><p>A special mention is required for the pub/sub API’s, they are relatively new and based on gRPC.</p><p><em>rpc Publish (PublishRequest) returns (PublishResponse)</em>; — publish one event</p><p><em>rpc PublishStream (stream PublishRequest) returns (stream PublishResponse);</em> — publish multiple events.</p><h3>Subscribing to a Platform Event</h3><p>A flow can be started or a paused flow can be resumed on receiving a platform event. Similarly a process can also subscribe to a platform event and get started off it. In Apex a trigger can process a platform event (on create event).</p><p>Lightning has the empApi component that works with both Aura and LWC’s to subscribe to a streaming channel and listen to events. External clients can implement cometD. Implement your own CometD client or use EMP Connector, an open-source, community-supported tool that implements all the details of connecting to CometD and listening on a channel.</p><p>And finally pub/sub API’s can also be used to subscribe just like publishing.</p><h3>Custom Channels</h3><p>You can create custom channels and add event types that will be part of the channel. Unfortunately CDC and Platform Events cannot be part of the same channel.</p><p>A channel is a good way to organize your domains, e.g you could have a channel for account management that can include all platform events related to accounts, contacts and their relationships. The subscriber then subscribes to the channel vs subscribing to individual platform events.</p><p>Custom channels can also be used to create filtered streaming so the subscriber to the channel only receives a subset of the events generated by a platform event. (filtered subscription where you could add a filtering criteria on a topic is not supported in platform events but achieved through channels)</p><h3>Additional Security</h3><p>If you have a shield encrypted org your data is encrypted at rest. You can extend that to encrypting your messages stored on the event bus. Before delivery to subscribers messages are decrypted, they are safe as they are delivered over a secure channel using HTTPS and TLS.</p><p>In the next part we will discuss Salesforce’s <a href="https://medium.com/@prajeetgadekar/salesforces-event-integrations-cdc-comparison-practical-tips-part-iii-a1ebf1eb910">Change Data Capture</a> and how it compares to using Platform Events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3984b5a3aaf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salesforce’s Event Integrations — PushTopics (Part I)]]></title>
            <link>https://medium.com/@prajeetgadekar/salesforces-event-integrations-pushtopics-part-i-962e48682944?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/962e48682944</guid>
            <category><![CDATA[salesforce-integration]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[salesforce]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 18:20:12 GMT</pubDate>
            <atom:updated>2023-06-25T18:31:21.773Z</atom:updated>
            <content:encoded><![CDATA[<h3>Salesforce’s Event Integrations — PushTopics (Part I)</h3><p>Based on a ton of feedback, we are going to break the paper on Salesforce’s event driven Integration architecture in to a series with byte sized articles.</p><p>This first part covers everything up to PushTopics.</p><p>Event driven communication revolves around the publisher-subscriber model. The publisher or the event generator broadcasts a message on a channel. Any listeners subscribed to the channel receive the message and can act upon it as it suits their needs. It’s like a tv station broadcasting signals in an area, a consumer who has the antenna pointed in the right direction will receive the signal.</p><p>It gets us out of point to point integrations and decouples the event producers from event consumers thus simplifying communication in a complex connected enterprise.</p><p>In this article we are going to talk about the evolution of event driven architecture on the core Salesforce.com platform. We will talk about the different options that are available today and the use cases in which those options should be exercised. Finally we will get into licensing and limits, and declutter the confusion around what limits apply on each one of these and how to extend them.</p><h3>Generic Events</h3><p>This is where it all started, but we will not deep dive as they are now Legacy, very very Legacy. Generic events involved creation of a streaming Channel without a predefined event schema in your Salesforce org and external or internal subscribers with EMP connectors. REST API was used to both push events and monitor the channel.</p><h3>PushTopic Events</h3><p>Salesforce’s Journey with events really took off with pushTopics. PushTopic events provide a secure and scalable way to receive notifications for changes to Salesforce data that match a SOQL query that you define. What that means is every time a CRUD operation is performed the PushTopic query is analyzed for impact, and if the change fell within the scope of the query, a notification is generated.</p><p>A PushTopic respects the users access based on sharing rules so they will only receive notifications for the records they have access to, this, with the ability to limit the stream of events to only those events that match a subscription filter helps control the volume a user receives.</p><p>The main intent when PushTopic was designed was to enable the ability of refreshing the UI of a custom app from Salesforce record changes. Push topic listener is a cometD client based on the Bayeux platform (long polling) so the listener could be a page in the Salesforce application or it could be an application server or a client outside the Salesforce platform.</p><p>PushTopics can be created from apex, API or Workbench</p><p>The CRUD part of when the notification should be generated is controlled by these four fields on a PushTopic</p><ul><li>NotifyForOperationCreate</li><li>NotifyForOperationUpdate</li><li>NotifyForOperationDelete</li><li>NotifyForOperationUndelete</li></ul><p>The NotifyForFields determines what is evaluated</p><ul><li>All (any change on in the record)</li><li>Referenced (referenced in the query SELECT or WHERE clauses)</li><li>Select (one of the fields in the SELECT clause changes)</li><li>Where (one of the fields in the WHERE clause changes)</li></ul><p>Let’s take a look at an example :</p><p><em>SELECT Id, Name, BillingCity, BillingState, BillingPostalCode, Phone from Account WHERE NumberOfEmployees &gt; 10000</em></p><p>In this example the payload includes everything in the select clause of the query, however, if the subscriber does not have access to any of these fields it is omitted from the notification the subscriber receives. On the other hand if the subscriber does not have access to the NumberOfEmployees field the subscription will fail. The query should always have an ID field, sub selects and aggregate queries are not supported.</p><p>Filtered subscriptions can be used to further filter the notifications received.</p><p><em>/topic/thisTopic?BillingState=’NY’&amp;BillingCity=’Newyork’</em></p><p>Salesforce stores PushTopic events, generic events and standard-volume events for 24 hours and they are available for replay. (High-volume are stored for 72 hours, but we will come to that later)</p><p>Unfortunately, PushTopic events are also now considered Legacy, which means no investment from product to improve and a limited support, so unless you have an existing implementation PushTopics should not be in the consideration.</p><p>In the next part we will talk about <a href="https://medium.com/@prajeetgadekar/salesforces-event-integrations-platform-events-part-ii-3984b5a3aaf3">Platform Events</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=962e48682944" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Future of Profiles in Salesforce]]></title>
            <link>https://medium.com/@prajeetgadekar/future-of-profiles-in-salesforce-4e8cbea6a2f2?source=rss-b7e805b7f419------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e8cbea6a2f2</guid>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[salesforce-architecture]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-security]]></category>
            <dc:creator><![CDATA[Prajeet Gadekar]]></dc:creator>
            <pubDate>Fri, 16 Jun 2023 21:42:23 GMT</pubDate>
            <atom:updated>2023-06-17T18:18:38.629Z</atom:updated>
            <content:encoded><![CDATA[<h4>Profiles were Everything</h4><p>If you have been in the Salesforce ecosystem for a decade or so, you know how important Profiles are and how important it is to get them right. Back in the day, any permissions in the system that were not directly related to accessing data (records) were at the Profile level, starting from CRUD access, to System Permissions all the way up to IP restricted logins and everything in between.</p><p>That started creating complexity in managing profiles for Salesforce Clients. The no. of profiles in some complex Orgs started to grow exponentially. I have personally seen Orgs that had more than 200 active profiles. Basically if you have a new user personal, that mapped to an existing persona, but with a few tweaks in permissions for their needs, you had no option but to create a brand new Profile.</p><h4>Introduction of Permission Sets</h4><p>Salesforce realized what the issue was and introduced Permission Sets. Basically, a delta of permissions that can be assigned to a user without having to create a new profile. This capability kept expanding every release since the initial introduction.</p><p>Then came the concept of Permission Set Groups, a way to group Permission Sets under one umbrella and assign the Group instead of assigning individual Permission Sets.</p><p>Then we had the Muting Permission Sets that can be added to a permission set group to revoke some permissions that a Permission Set in a Permission Set Group is giving.</p><p>There are many use cases for Muting Permission Sets e.g when you want to use a Permission Set in a Permission Set Group but may have to create another Permission Set just because of a small subset of permissions that you cannot give, you may create a Muting Permission Set instead and add it to the Permission Set Group .</p><p>But the bottom line is that the new model gives you a lot of flexibility. As an architect you can decide what level of granularity you are looking for in a Permission Set or a Permission Set Gropu. In a typical enterprise you would generally map your Users to Active Directory and your Profiles to AD Groups. Ad GrouPermission Set could map to a lot of things, roles, public groups etc but in this new world they should ideally map to a Permission Set Group and you manage the Salesforce security complexity inside a Permission Set Group so our Identity provider does not have to worry about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WNB5v34VGCVvBUj_" /></figure><h4>Are profiles Deprecating?</h4><p>But why are we talking about this now? Unless you have been living under a rock you already know that Profiles are going to Deprecate, eventually, its a long roadmap so you are safe now but the future is Permission Set Group and Permission Sets. At some point in the future you will have to fully migrate to Permission Sets and Permission Set Groups but if you are in a greenfield implementation now, how can your decisions today save you from a costly migration in the future, let’s talk about that.</p><p>Here is the official article about the deprecation plan:</p><p><a href="https://admin.salesforce.com/blog/2023/permissions-updates-learn-moar-spring-23">https://admin.salesforce.com/blog/2023/permissions-updates-learn-moar-spring-23</a></p><p>Profiles are not fully deprecated they will still exist but only with these functions</p><ul><li>One-to-one relationships — login hours/IP ranges</li><li>Defaults — record types, apps</li><li>Page layout assignment — The future is App Builder/Dynamic Forms so we will not invest in bringing page layout assignment to permission sets.</li></ul><p>Everything else moves over to Permission Sets.</p><ul><li>User permissions (system and app permissions)</li><li>Object permissions (object Create, Read, Update, and Delete [CRUD])</li><li>Field permissions (field-level security [FLS])</li><li>Tabs</li><li>Record types (not defaults)</li><li>Apps (not defaults)</li><li>Connected app access</li><li>Apex classes</li><li>VisualForce pages</li><li>Custom permissions</li></ul><p>There is a beta to automate the migration but why even worry about it if you can build the right way ground up in a greenfield implementation.</p><p>Here are some best practices on how we make a decision around a profile, permission set and permission set groups.</p><ul><li>Identify your Personas (Note that Persona’s are not profiles)</li><li>Trying to minimize Profiles. Default record types and apps is really the only reason for a separate Profile. (Move to Dynamic forms if you can)</li><li>Layer Permission Sets based on job function.</li><li>Bundle Permission Sets through Permission Set Group, ideally one per Persona.</li></ul><p>To double click on Dynamic forms, page layout assignments is really the only big dependency on Profiles. Otherwise everything in the lightning builder is very flexible. You can now go down to the component level to control visibility by user attributes or Custom Permissions. The detail tab comes out of the traditional page layout. Once that is updated to dynamic forms that key dependency ends and it’s easier to imagine a world without Profiles. (Dynamic forms currently support limited standard objects and all custom objects, but the basic Lead, Account, Contact, Opportunity, Case are covered).</p><p>Note that profiles are still involved in assigning a lightning record page, but it’s somewhat irrelevant, you can have one version of the page for all profiles, because you are now able to granularly control visibility of everything inside the page.</p><p>Here is a sample decision making flowchart you can use when you have a new persona that you are trying to assess. This example assumes you have a set of Profiles, Permission Set and PSG’s and are assessing a new Persona.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fc4aOKcFPedOwGvs" /></figure><h4>In Conclusion</h4><p>Adapt to Permission Sets and Permission Set Groups and reduce dependency on Profiles. In Parallel, also start adopting dynamic forms. This will help you prevent a potentially costly migration from Profiles to Permission sets and page layouts to Dynamic forms in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e8cbea6a2f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>