<?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 Chris Carpenter on Medium]]></title>
        <description><![CDATA[Stories by Chris Carpenter on Medium]]></description>
        <link>https://medium.com/@chriscarp?source=rss-45f57dff3e49------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8NWKxZttUmd1hQqC73BdWw.jpeg</url>
            <title>Stories by Chris Carpenter on Medium</title>
            <link>https://medium.com/@chriscarp?source=rss-45f57dff3e49------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:41:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chriscarp/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[A More Accessible Apex Framework Part 2: Database Transactions]]></title>
            <link>https://medium.com/@chriscarp/a-more-accessible-apex-framework-part-2-database-transactions-3cfd35f9c4ed?source=rss-45f57dff3e49------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cfd35f9c4ed</guid>
            <category><![CDATA[information-systems]]></category>
            <category><![CDATA[apex]]></category>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Chris Carpenter]]></dc:creator>
            <pubDate>Fri, 08 Dec 2023 02:39:22 GMT</pubDate>
            <atom:updated>2023-12-08T02:39:22.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7SdKRO8uMvMC2A-rIxBmg.jpeg" /><figcaption>Photo Credit <a href="https://unsplash.com/@jankolar">Jan Antonin Kolar</a></figcaption></figure><p>In <a href="https://medium.com/@chriscarp/a-more-accessible-apex-framework-part-1-introducing-the-model-4871f496c6b3">part one</a> of this series, we went through a high-level overview of the framework and its components. In this article, we will dive more deeply into database transactions. Specifically, we will look at how to aggregate multiple dml statements into a single database transaction using methods in the DatabaseTranaction class.</p><p>As before, the full template code for this framework including the DatabaseTransaction class can be found <a href="https://github.com/Christopher-B-Carpenter/lightweightApexFramwork">here.</a></p><h4>The DatabaseTransaction Class</h4><p>When implementing this framework, all database interactions will be executed using one of the built-in methods in the DatabaseTransaction class. These methods allow you to register the database changes as they occur in your code without the need for a discrete DML statement each time. Instead, the changes are collected and processed in a single database method for each transaction type (update, insert, delete).</p><h4>Inserting Records</h4><p>When you need to insert a new record, call the registerInsert method and pass the record that you would like inserted into the database.</p><pre>DatabaseTransaction databaseTransaction = new DatabaseTransaction();<br>SObjectA sobjectA = new SObjectA(/*set field values*/);<br>databaseTransaction.registerInsert(sobjectA);</pre><p>The record will be added to the list to insert at the end of the transaction.</p><h4>Deleting Records</h4><p>When you want to delete a record then call the registerDelete method and pass the record that you would like to delete.</p><pre>DatabaseTransaction databaseTransaction = new DatabaseTransaction();<br>SObjectA sobjectA = new SObjectA(/*set field values*/);<br>databaseTransaction.registerDelete(sobjectA);</pre><p>The record will be added to the list to delete at the end of the transaction.</p><h4>Updating Records</h4><p>It gets more complex when you need to update a record. This is because there may be multiple updates to the same record that occur across the transaction. How do we collect all of these updates into a single DML call? First, we must check if the record has already been registered with the DatabaseTransaction class. We can do this by following this pattern anytime we would like to make an update to a record.</p><pre>DatabaseTransaction databaseTransaction = new DatabaseTransaction();<br>SObjectA sobjectA = (SObjectA) databaseTransaction.getUniqueRecord(sobjectA);<br>sobjectA.Some_Field__c = &#39;new value&#39;;<br>databaseTransaction.registerUpdate(sobjectA);</pre><p>The getUniqueRecord method checks the current list of records to update and returns the matching record if it exists, otherwise, it returns the record that was passed. Using this method before registering updates ensures that all updates to a single record are collected and the record is updated only once.</p><h4>Inserting Relationships</h4><p>The most complex database interaction that we will need to handle is the insertion of related records. Because we need the Id of the parent record to link the child record, this record must be inserted first. To handle this scenario we can leverage the registerRelationshipInsert method.</p><pre>DatabaseTransaction databaseTransaction = new DatabaseTransaction();<br>SObjectA sobjectA = new SObjectA(/*set field values*/);<br>SObjectB sobjectA = new SObjectB(/*set field values*/);<br>databaseTransaction.registerRelationshipInsert(sobjectB, sobjectA, SObjectA.Some_Lookup_Field__c.getDescribe().getSObjectField());</pre><p>In this example, sobjectB is the parent record and sobjectA is the child. In the method call we specify the lookup field on sobjectA that should be populated with the id of sobjectB. The DatabaseTransaction class handles all of the heavy lifting of inserting the parent, collecting the id, and then inserting the child with the lookup populated. It does this for all relationships registered in the transaction.</p><p>Note: All of the methods for registering records (except for registerRelationshipInsert) can be called with a single record or a list of records</p><h4>Executing the Database Calls</h4><p>Now that we have collected all of the database calls that need to occur, we need to ensure that they are executed at the end of our transaction. To do this we call the doDML method from the DatabaseTranaction class at the end of the isAfter section on the trigger for that object.</p><pre>trigger SobjectTrigger on SObject (before insert, before update, before delete, after insert, after update, after delete, after undelete) {<br>    SObjectTriggerHandler handler = new SObjectTriggerHandler();<br>    <br>    if (Trigger.isBefore) { <br>        //before logic<br>    }   <br>    else if (Trigger.isAfter) {<br><br>        //after logic<br><br>        handler.doDML();<br><br>    } <br>    <br>}</pre><p>The doDML method executes database methods to update insert or delete the records that were registered across the transaction. This results in a significant reduction of the number of DML statements in the code which leads to faster code execution and lower risk of limits breaches.</p><p>That covers it for the DatabaseTransaction class! Next time we will go over unit tests and how to leverage this framework to write true unit tests that do not depend on the database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cfd35f9c4ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A More Accessible Apex Framework Part 1: Introducing the Model]]></title>
            <link>https://medium.com/@chriscarp/a-more-accessible-apex-framework-part-1-introducing-the-model-4871f496c6b3?source=rss-45f57dff3e49------2</link>
            <guid isPermaLink="false">https://medium.com/p/4871f496c6b3</guid>
            <category><![CDATA[salesforce-architect]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[apex]]></category>
            <dc:creator><![CDATA[Chris Carpenter]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 14:03:42 GMT</pubDate>
            <atom:updated>2024-03-19T02:56:16.527Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJKoPQJRfU-KDHYNOq2rIQ.jpeg" /><figcaption>Photo Credit: <a href="https://unsplash.com/@rgaleriacom">Ricardo Gomez Angel</a></figcaption></figure><p><em>This is the first in a multi-part series. The reference code for this framework can be found </em><a href="https://github.com/Christopher-B-Carpenter/lightweightApexFramwork"><em>here.</em></a></p><p>As salesforce orgs age and become more complex it is becoming increasingly necessary, even for smaller orgs, to adopt consistent patterns and frameworks for their Apex codebase. A consistent framework will allow for quicker maintenance work, reduced troubleshooting time, faster tests, and ultimately decreased system load. All of this allows for the codebase to scale alongside the business.</p><p>While the necessity for such a framework is nearly universal, there are limited choices when it comes to established Apex frameworks that an architect may look to implement. FFLib is probably the most widely known and well-used of these frameworks; however, its immense complexity can be a barrier to entry for many, especially those working with a smaller development team or without the appropriate time required for implementation. In most cases, this leaves little option other than to work with what is existing and try to improve in smaller areas over time. Unfortunately, it’s nearly impossible to see significant improvements within this approach as any improvements, however well-intentioned, if not structured in a consistent way can at best show incremental improvements and at worst can work against each other causing more harm as the code-base grows.</p><p>Given the situation, a lighter-weight solution is needed that can be implemented in a shorter time frame with a smaller team that will still give many of the primary benefits of a more complex framework albeit without some of the more nuanced features. Let’s start by establishing some goals that outline the minimum features necessary for this type of framework:</p><h4>Goals</h4><ol><li>Separate object-specific actions into individual classes decoupled from routing logic. This allows for clarity when scaling the codebase and will promote code reuse.</li><li>Manage DML by collecting database actions across the execution into a single DML transaction. This allows for the decoupling of DML actions from individual methods.</li><li>Separate SOQL queries into independent classes. This allows for the mocking of queries during testing and promoting code reuse</li><li>Eliminate the need for database transactions in apex unit tests. This allows for true unit tests of methods without firing other portions of code when data is inserted updated or queried.</li></ol><h4>Basic Elements</h4><p>Like other frameworks, this framework relies on the concept of separation of concerns in order to delegate specific functions to specific classes. It leverages interfaces to create consistency and allow for dependency injection. Following the spirit of the Unit of Work concept in FFLib, a way of centrally collecting DML will be employed (although in a much more basic manor). Finally, as in most trigger frameworks, each object will have a Trigger and Trigger Handler, but will also have a Service class and a Selector class. The complete set of object-specific class types and definitions is as follows:</p><ul><li><strong>Trigger (‘SObjectTrigger”)</strong> — routes to the appropriate handler method depending on the trigger context</li><li><strong>Trigger Handler (“SObjectTriggerHandler”)</strong> — contains logic to answer the question: ‘what actions need to be taken?’ in the given record-triggered scenario, then calls the appropriate Service class method.</li><li><strong>Service (“SObjectService”)</strong> — handles actions (DML) to be taken related to that object</li><li><strong>Selector (“SObjectSelector”)</strong> — handles all queries against the specified object</li><li><strong>Selector Interface (“ISObjectSelector”)</strong> — an interface defining the selector methods to allow for runtime dependency injection during tests</li><li><strong>Selector Mock (“SObjectSelectorMock”)</strong> — a mock selector class to return mock query data in a test context</li></ul><p>Finally, in addition to each object-specific class listed above, there is a global class<strong> “DatabaseTranaction”</strong> that will handle all DML actions needed during the trigger execution. This class contains methods for registering updates and inserts that will then be executed simultaneously at the end of the apex execution.</p><h4>The High-Level Pattern</h4><p>Now that we have designated classes to handle all of the operations that might occur during a Trigger execution, we can begin to map out how to implement the framework. This is best done by outlining a set of rules to follow for the Classes and their interactions that will ensure the initial goals of the framework are met and the codebase remains consistent as it grows. Beyond these rules, the framework is flexible and can adapt to any coding style/subframeworks that one may wish to use.</p><p>The first rule follows what is more or less a standard of trigger frameworks: the trigger itself should contain no functional code, but instead should route directly to the appropriate handler method.</p><pre>    if (Trigger.isBefore) { <br><br>        handler.isBefore(Trigger.oldMap, Trigger.new);<br><br>        if (Trigger.isInsert){<br>            handler.isBeforeInsert(Trigger.new);<br>        } <br>        else if (Trigger.isUpdate){<br>            handler.isBeforeUpdate(Trigger.oldMap, Trigger.new);<br>        } <br>        else if (Trigger.isDelete){<br>            handler.isBeforeDelete(Trigger.oldMap);<br>        }<br>    }</pre><p>The TriggerHandler class should only contain routing logic i.e. it should be answering the question: in this scenario, what code needs to run? This serves two purposes: to keep the handler class independent from any object specific actions, and to prevent recurison (if routing criteria are written correctly, there should not be a reason for the code to run twice and it will stop at the handler layer).</p><pre>    public void isBeforeInsert(List&lt;SObjectA&gt; newList){ <br>        //loop through records<br>        if(*records meet some criteria*){<br>            //call service method with onlythe records that meet criteria<br>        }<br>    }</pre><p>The Service class should be specific to an object and only contain methods that take actions against that object’s data. This means that Object A’s trigger handler might call Object B’s service class if updates are needed to that object. Each method in the Service class should correspond to a specific action. This allows for these methods to be called from anywhere (not just a trigger context) and promotes code reuse.</p><pre>public class SobjectAService {<br>    public void exampleUpdateTriggeringRecords(List&lt;SObjectA&gt; sobjectAs){<br>      //update records<br>    }<br>}</pre><p>The Selector Class for and Object should contain only methods for quering data for the specified object. These methods should return records of that object only (in list or map format). Any time a query needs to be made, a selector method should be called. Selector methods should be written to promote reuse (i.e. by including a field set that can be added to as opposed to creating new methods when different fields are required).</p><pre>public class SobjectBSelector implements ISobjectBSelector {<br>    <br>    private String fields = &#39;Id&#39;;<br><br>    public Map&lt;Id,SobjectB&gt; getSobjectBsBySObjectAId(Set&lt;Id&gt; sobjectAIds){<br>        return new Map&lt;id,SObjectB&gt;((List&lt;SObjectB&gt;) database.query(&#39;SELECT &#39; + fields + &#39; FROM SObjectB where SObjectAId in :sobjectBIds&#39;));<br>    }<br><br>}</pre><p>The Mock Selector class for and Object should contain methods that return mock data to match what is returned in the parallel Selector method without performing any DML. This will allow for true unit tests that are decoupled from the database.</p><pre>public class SobjectBSelectorMock implements ISobjectBSelector {<br><br>    Static Integer fakeIdCounter = 1; <br>    Static Map&lt;Id,SObjectB&gt; sobjectBsFromGetSobjectBs = new Map&lt;Id, SObjectB&gt;();<br>    <br>    public static String getFakeId(Schema.SObjectType type) {<br>        String result = String.valueOf(fakeIdCounter++);<br>        return type.getDescribe().getKeyPrefix() + &#39;0&#39;.repeat(12 - result.length()) + result;<br>    }<br>     <br>    public Map&lt;Id,SObjectB&gt; getSobjectBsById(Set&lt;Id&gt; sobjectAIds){<br><br>        if(sobjectBsFromGetSobjectBs.size() &gt; 0){<br>            //return the existing list if already generated. This allows for associations to be created in tests <br>            return sobjectsFromGetSobjectBs;<br>        }<br>        else{<br>            Map&lt;Id,SObjectB&gt; mockSObjectBs = new Map&lt;Id,SObjectB&gt;();<br><br>            for(Id sobjectA : sobjectAIds){<br>                SObjectB mockSObjectB = new SObjectB(<br>                    Id = getFakeId(Schema.SObjectB.SObjectType),<br>                    SObjectAID = sobjectA.Id<br>                    //add aditional fields here to match what is returned by the real selector query<br>                );<br>                mockSObjectBs.put(mockSObjectB.id,mockSObjectB);<br>            }<br>            <br>            sobjectsBFromGetSobjectBs = mockSObjectBs;<br>            return mockSObjectBs;<br>        }<br><br>    }<br>}</pre><p>Both the Selector and the Mock Slector should implement the Selector Interface. This will allow for dependency injection at runtime to allow for the mock to be substituted in the test contex, but also ensures that each Selector method always has a parallel Mock method.</p><p>All DML actions should be passed to the DatabaseTransaction class using the built in methods for registering inserts and updates. These actions will be collected and executed in one set of DML actions at the end of the trigger execution. This will ensure that limits can be easily managed and will also allow for tests to be decoupled from the database. (I will cover the specific patterns for each DML type in the next article)</p><pre>public class SobjectAService {<br>  public void exampleUpdateTriggeringRecords(List&lt;SObjectA&gt; sobjectAs){<br>    <br>    //get unique record to update - in case the same record has been updated elsewhere.<br>    //This ensures that updates can be made to the same record in multiple places and still<br>    //collected for a single database transaction<br>    SObjectA sobjectA = (SObjectA) databaseTransaction.getUniqueRecord(sobjectA);<br>    //updates to sobjectA records<br><br>    //register the update regardless of if it is before or after context<br>    //this allows for methods to be reused in both contexts as needed<br>    //the database transaction class checks for the context before attempting DML<br>    databaseTransaction.registerUpdate(sobjectA);<br>  }<br>}</pre><h4>Putting it all Together</h4><p>In order for the Framework to function properly, we need to establish the method for linking the classes together in a way that will allow us to achieve the goals stated above. Luckily because each class encapsulates a specific set of functionality, we can use that to guide when each should be instanciated as we move through the execution.</p><p>Starting from the Trigger, let’s trace these dependencies through the various classes to demonstrate how the dependencies between instances of each class should be established.</p><p>In the Trigger, an instance of that object’s handler is created in order to call the context specific methods for each trigger context:</p><pre>trigger SobjectTrigger on SObject (before insert, before update, before delete, after insert, after update, after delete, after undelete) {<br>    <br>  SObjectTriggerHandler handler = new SObjectTriggerHandler();<br><br>}</pre><p>In the Trigger Handler, we need to create instances of any Services Classes that will be referenced. No Selector Classes should be instanciated here because the Handler only contains routing logic and should not need to query data. Although the Handler does not perform any database actions, the Database Transaction class is instanciated here so that it can be passed to the various Service Methods in order to collect DML actions across the execution:</p><pre>public class SobjectATriggerHandler {<br>  DatabaseTransaction databaseTransaction = new DatabaseTransaction();<br>  SobjectBService sobjectAService = new SobjectAService(databaseTransaction);<br>  SobjectBService sobjectBService = new SobjectBService(databaseTransaction);<br><br>  //context specific methods and routing logic <br><br>}</pre><p>In the Service Class, we can leverage an overloaded constructor to allow for the option to specify any selector classes at run time. This will allow for us to inject the Mock Selector class in a test context. The constructors also allow for the DatabaseTransaction class to be passed from the Handler:</p><pre>public class SobjectAService {<br>    private DatabaseTransaction databaseTransaction;<br>    private ISobjectBSelector sobjectBSelector;<br><br>    public SobjectService(DatabaseTransaction databaseTransaction) {<br>        this(new SobjectBSelector(), databaseTransaction);<br>    }<br><br>    public SobjectService(ISobjectBSelector sobjectBSelector, DatabaseTransaction databaseTransaction){<br>        this.databaseTransaction = databaseTransaction;<br>        this.sobjectBSelector = sobjectBSelector;<br>    }<br><br>}</pre><p>And that’s it! That’s as complicated as the relationships in this framework get. Once the shells of these classes are written, they can be expanded indefinitely by adding new methods withing the rules listed above. Queries and DML will scale linearly and will be easily auditable. In the next articles, I will outline more detailed patterns around the DatabaseTransaction class as well as dive into writing true unit tests using this framework.</p><p>As mentioned above, the reference classes for the framework can be found <a href="https://github.com/Christopher-B-Carpenter/lightweightApexFramwork">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4871f496c6b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architecting Information Systems with an ‘Automation Second’ Mindset]]></title>
            <link>https://medium.com/@chriscarp/architecting-information-systems-with-an-automation-second-mindset-eff26acbda30?source=rss-45f57dff3e49------2</link>
            <guid isPermaLink="false">https://medium.com/p/eff26acbda30</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[information-systems]]></category>
            <dc:creator><![CDATA[Chris Carpenter]]></dc:creator>
            <pubDate>Wed, 17 Aug 2022 18:39:27 GMT</pubDate>
            <atom:updated>2022-08-18T21:22:14.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi-Dp-k6q_2nr0m_LrWkeg.jpeg" /><figcaption>Photo Credit: @possessedphotography</figcaption></figure><p>If you have worked in information systems in the start-up space (or most companies these days) you likely have come face to face with the idea of “automating your job away”. The concept is that you should always be looking to find ways to make your job more efficient (usually through automation) in order to save yourself and the company time and ultimately money.</p><p>For a start-up or other companies with limited resources this ‘scrappy’ strategy makes sense on a variety of levels and can lead to real short-term value in terms of time savings etc. However, this concept seems to have grown beyond its original intentions to the point where it has become the default strategy when approaching solution design in information systems (Salesforce in particular). This can lead to significant architectural issues not limited to lack of scalability, poorly understood dependencies, high maintenance cost, and system resource/limits issues.</p><p>Ultimately, systems that have been built out with an automation-first mindset will likely end up being less efficient and more costly than the original work they were intended to replace.</p><p>So how do we begin to address this issue and reverse something that has become firmly embedded in the culture of information systems design? I’ll be the first to admit I have fallen into this cycle myself when approaching system architecture. With the number of easily accessible automation tools available these days it can be hard to resist the urge to quickly whip up automation to address the problem at hand and make someone’s (or your own) job a little easier. To move away from this mindset, we need to be intentional about countering our natural reaction and place automation strategy firmly as a secondary consideration in the architecture process.</p><p>This is not to argue for what should already be apparent: that automation should come behind other primary steps in an architecture development process (i.e. you should understand the data structure and business process before considering automation). Rather, I would take it a step further and argue that automation should not even be considered as part of the initial implementation of any information systems solution. Instead, it should only be considered once you have been able to collect real functional data around how users are interacting with the system for some time. At this point, it will be clear where automation can provide the most real value and you can make decisions on which areas of the process should be targeted based on real data.</p><p>The ideal process might look something like this:</p><ol><li>Design and implement an automation free solution focused on an accurate data structure and business process flow.</li><li>Iterate on this solution to refine the data model and process flow. Your cycle time for this step will be significantly shorter due to the lack of complexity that automation would have added.</li><li>Once you are confident the data structure and process flow are correct from observation and user feedback, begin to look for areas where you would see the greatest efficiency gains from automation. Are there areas where users are performing repetitive tasks? Are there complex calculations, or logic that is being performed outside of the system in order to accurately enter or manipulate data? Because you have gone through the previous steps, when you identify these areas now you will have confidence that you are targeting real areas where efficiencies can be gained, and you are not just creating automation for automation’s sake.</li></ol><p>Automation implemented with this approach will be more likely to have long term value because you have taken the time to identify the true areas of need. In addition, because this approach is intended to target specific areas where there will be clear efficiency gains, the automation created will likely be significantly less complex than if the entire process was automated from the beginning. Over time you will be less likely to create unnecessary dependencies in your automation because each piece of automation will be much more targeted. This reduced complexity and fewer dependencies will allow you to be more flexible when a change in business process requires a system change.</p><p>It is worth noting at this point that it’s likely that you will receive pushback for taking this approach. The push for automation as a quick path to efficiency is a common thread across business functions and the idea of performing tasks or entering data manually for any period can be met with skepticism when automation is so readily available. The reality is that automation and efficiency are not synonymous and, in many cases, can be opposites. Automation implemented for the wrong reasons, in the wrong way, or just for the sake of it can ultimately increase the development lead time and maintenance costs for a system to the point where the system is no longer able to be reasonably flexible to changing business needs. Once this point has been reached, your automation is now a liability and not a source of efficiency. Although it can be difficult, this is what must be communicated to stakeholders when approaching system architecture and solution design. It can be helpful to outline a strategy like the above and to clearly communicate how collecting usage data will inform automation solutions that ultimately provide the most value and long-term system flexibility and scalability. Remember, it’s likely that your stakeholders are painfully aware of what an inflexible system looks like in the face of changing business needs so this can be an easier sell than it may seem at first!</p><p>When systematizing business processes, it is important that we take a step back and re-evaluate our reliance on automation as a default solutioning tool. We need to resist the urge to reach for the grab-bag of easily implementable automation solutions that are so readily available these days and to take a procedural, data-driven approach to identifying automation opportunities. Doing so will not only make your systems strategy more sustainable, but it will also ultimately lead to more true, long-term efficiency gains for your business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eff26acbda30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluate Integrations with a Risk Assessment Framework]]></title>
            <link>https://medium.com/salesforce-architects/evaluate-integrations-with-a-risk-assessment-framework-e78b27d2deb2?source=rss-45f57dff3e49------2</link>
            <guid isPermaLink="false">https://medium.com/p/e78b27d2deb2</guid>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[risk-assessment]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-integration]]></category>
            <category><![CDATA[salesforce-architect]]></category>
            <dc:creator><![CDATA[Chris Carpenter]]></dc:creator>
            <pubDate>Tue, 02 Aug 2022 19:41:06 GMT</pubDate>
            <atom:updated>2022-08-02T19:41:06.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Image of abstract wooden geometric shapes" src="https://cdn-images-1.medium.com/max/1024/1*y5rIJChLiRAD0myfw2bqnw.jpeg" /></figure><p>Integrations are an integral part of Salesforce implementations. However, each integration adds complexity to the system, and as a result, new areas for potential system or business risks. As an architect, understanding these risks is important to maintaining system integrity and security.</p><p>While this might seem straightforward on the surface, consistently evaluating integrations and communicating the results with the business can prove difficult in practice without an established process.</p><p>Establishing a risk assessment framework and using it to assess new (and existing!) integrations can help guide your evaluation process and create a common language between development teams and the business. In addition, documenting mitigation steps for higher severity risks can provide an accountability structure for ensuring that these risks do not go unaddressed.</p><p>This post covers the creation of a risk assessment framework and the application of the framework to some example integration risks. It also covers common use cases where a risk assessment framework can be applied.</p><p>But before getting started, let’s consider a fundamental question.</p><h3>What do we mean by risk?</h3><p>All of us have some intuition for what we mean when we think of risk, but to create a common language for evaluating and discussing risk, architects need something more concrete.</p><p>The widely accepted technical definition of risk is:</p><blockquote><em>Risk Severity = (Likelihood) x (Impact)</em></blockquote><p>Or in other words: <em>Given a possible negative event, the severity of the risk associated with the event is determined by combining the likelihood that the event will happen with the impact of the event if it does happen.</em></p><p>While this definition is a good start, as an architect, you need a way to document the impact, likelihood, and ultimately risk severity in an understandable and consistent way. One way to do this is to assign simple text labels (Low, Medium, High) for likelihood and impact and fill out a matrix that maps out the overall severity of the risk. The row and column headers of the matrix represent likelihood and impact respectively. The risk severity is defined at each intersection.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82d5972077b68732c0aa78eb5b23e056/href">https://medium.com/media/82d5972077b68732c0aa78eb5b23e056/href</a></iframe><p>Alternatively, you might prefer to use a more quantitative approach and assign numeric values to both likelihood and impact. This approach results in risk severity values that are numeric multiples of the likelihood and impact values, for example:</p><ul><li>Likelihood = 9</li><li>Impact = 5</li><li>Risk = 5x9 = 45</li></ul><p>The key is clarity and consistency. The numbers or levels are more or less arbitrary; it’s the ability to compare risks relative to each other that is important. Think about how you would like to present information relating to risk and who your audience will be. Then choose a consistent methodology and stick to it.</p><h3>Establish a risk assessment framework</h3><p>Now that you have a clearer definition of risk, the next step is to develop a framework that can be used for assessing risks. Again, the key here is to define a process that you can repeat consistently (in this case, for all integrations). Luckily, risk assessments are a standard tool used in many roles across multiple industries and ample material exists for reference. For starters, the <a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-30r1.pdf">NIST Guide for Conducting Risk Assessments</a> is an excellent reference to understanding risk assessment strategies in detail. A more implementation-focused resource is the <a href="https://owasp.org/www-community/OWASP_Risk_Rating_Methodology">OWASP Risk Rating Methodology</a>, a risk assessment framework used for evaluating web and software vulnerabilities. The steps outlined in this post are derived from this methodology, but I recommend conducting your own research to align — and refine — your risk assessment based on your specific goals.</p><p>To see how such a framework works in practice, let’s go through some sample steps that are commonly included in a risk assessment using real-world risk scenarios that you might encounter when evaluating an integration. I follow these steps in the risk assessment framework that I use for my org.</p><h4>1. Identify potential risks</h4><p>The first step of any risk assessment is to identify potential risks. In this case, that means evaluating an integration from a technical and business perspective to determine the potential for any negative impacts. Let’s say for example, you discover that the way in which the integration stores or transfers data poses a risk of exposing customer data. In addition, the integration may require some amount of maintenance, posing a risk to your team’s capacity. Keep a list of each risk you discover:</p><ul><li>Customer data exposure</li><li>Increased team maintenance load</li></ul><p><strong>2. Determine the severity of each risk</strong></p><p>Next, evaluate the impact and likelihood of each risk in order to establish the severity.</p><p>When determining impact, think about all of the possible consequences if the risk is realized. Remember to consider factors both internal and external to Salesforce! As you go through this evaluation process, document all of the factors that contribute to your assessment of the impact.</p><p>In this example, which uses the Low, Medium, High approach for documenting impact and severity, the impact of customer data loss is High based on the potential consequences. Likewise, the impact of increased team maintenance load is Low given the small impact to capacity:</p><p><strong>Customer Data Exposure</strong><br><strong>Impact</strong>: HIGH<br><strong>Impact Factors: </strong>Loss of customer trust, Potential financial loss</p><p><strong>Increased Team Maintenance Load</strong><br><strong>Impact</strong>: LOW<br><strong>Impact Factors: </strong>Small loss of capacity for other initiatives</p><p>Next, determine likelihood. When evaluating likelihood, it is helpful to think through specific scenarios that might cause the risk to be realized in addition to specific factors that may increase or decrease the likelihood. Document these factors and scenarios that contribute to your assessment of the likelihood. The likelihood values and factors for this example are:</p><p><strong>Customer Data Exposure</strong><br><strong>Likelihood</strong>: MEDIUM<br><strong>Likelihood Factors:</strong></p><ul><li>Data is encrypted in transit and visibility can be restricted using settings in the package</li><li>By default, all internal users have access to the integration settings controlling data visibility and could make changes</li></ul><p><strong>Increased Team Maintenance Load</strong><br><strong>Likelihood</strong>: HIGH<br><strong>Likelihood</strong> <strong>Factors</strong>: Certain data mapping settings will need to be changed frequently but are only accessible to admin users</p><p>Once you have determined the impact and likelihood for each risk, combine them to assign a severity to each risk. Since this example uses the Low, Medium, High approach to documenting risk, the severity is determined using the criteria shown above:</p><p><strong>Customer Data Exposure</strong><br><strong>Severity</strong>:<strong> HIGH</strong></p><p><strong>Increased Team Maintenance Load</strong><br><strong>Severity</strong>: MEDIUM</p><p>Here, the Customer Data Exposure risk is High despite having only a Medium likelihood of actually happening. This reflects the severe impact of exposure, however likely. Likewise, the risk of Increased Team Maintenance Load is Medium despite the Low impact since the likelihood of it occurring is High. Accurately evaluating both impact and likelihood is key to a solid understanding of risk severity.</p><h4>3. Determine the overall risk of the integration</h4><p>Once you have determined the severity of each risk, you can evaluate the overall risk of the integration. In general, the rule I use is simply to set the risk of the integration to be equal to the highest severity risk identified. In this example, this means that the overall integration risk is High. Assigning an overall risk is useful in situations where you are evaluating a new integration or performing a comparative analysis between solutions; in some situations, however, you may find it unnecessary. Alternatively, the above approach may be too simplistic and you might find that establishing a more rigorous process for determining the overall risk is needed. Keep the context in which you are performing your risk assessment in mind when deciding if or how to determine the overall risk of an integration.</p><h4>4. Define mitigation steps for each risk as necessary</h4><p>Defining mitigation steps is arguably the most important aspect of a risk assessment. There’s no use identifying risks if you don’t plan to do anything about them. If any high severity risks (or risks that you or the business are uncomfortable moving forward without addressing) are identified as part of the assessment it will be necessary to determine mitigation steps before proceeding with the integration. These steps should be targeted at reducing either the impact or likelihood of the risk (or both). In this example, after identifying the risk severity of Customer Data Exposure as High, the following mitigation steps are defined:</p><p><strong>Customer Data Exposure</strong><br><strong>Severity: HIGH</strong><br><strong>Mitigation Owner: </strong>Margaret Smith<br><strong>Mitigation Steps: </strong>Update permissions to integration settings to limit access to a selected group of users</p><p>In this example, the mitigation step is straightforward, but this is frequently not the case. Mitigation steps might include significant changes to the integration strategy, continuous monitoring, or other actions that require a high level of effort. In these situations, assigning a mitigation owner is an important step to maintain accountability. In general, the owner should be the individual who will perform the mitigation steps.</p><h4>5. Document results and communicate</h4><p>In this step, you combine all of the above information for each risk in a single document. Normally, you’d do this as you go through each assessment step. You may want to include a template as part of your framework to help with this step. Here is the <a href="https://salesforce.quip.com/TmDCAxjkoglD?template=1">template</a> I use in assessments:</p><p><strong>Risk: &lt;description of risk&gt;</strong><br><strong>Impact:</strong> &lt;Level or Score&gt;</p><ul><li>Impact factor 1</li><li>Impact factor 2</li></ul><p><strong>Likelihood:</strong> &lt;Level or Score&gt;</p><ul><li>Likelihood factor 1</li><li>Likelihood factor 2</li></ul><p><strong>Severity:</strong> &lt;Level or Score&gt;<br><strong>Mitigation Owner: </strong>&lt;Owner&gt;<br><strong>Mitigation Steps:</strong></p><ul><li>Mitigation Step 1</li><li>Mitigation Step 2</li></ul><p>How you format your document will vary depending on the goals for your risk assessment and your audience. For example, if you are using the assessment to provide a recommendation on whether or not to proceed with integration, you might want to focus on only the most severe risks and potential mitigation steps for discussion with business stakeholders. I have found that in addition to the detailed analysis for each risk as seen above, it is useful to create a summary of the assessment to communicate the key information to stakeholders. You can use <a href="https://salesforce.quip.com/TmDCAxjkoglD?template=1">this template </a>based on the format I use to get started. For this example, the summary might look something like:</p><p><strong>Business Owner</strong>: Betty Jones<br><strong>Overall Risk</strong>: HIGH<br><strong>Approved: </strong>No — 07/07/2022<br><strong>Last Assessment Date: </strong>07/07/2022</p><h3>Overall Integration Risk</h3><p>Given the assessed severity of the following identified risks:</p><ul><li>Customer Data Exposure HIGH</li><li>Increased Salesforce Team Maintenance Load MEDIUM</li></ul><p>The overall integration risk has been deemed to be HIGH and the integration cannot proceed without completing the following mitigation steps:</p><ul><li>Update integration settings to limit access to a selected group of users (Owner: Margaret Smith)</li></ul><p>Store the complete outputs of your assessment in a location that is easily accessible for your team as well as your business stakeholders.</p><h4>6. Rinse and repeat!</h4><p>Salesforce orgs are ever-changing, and in many cases risks that were once associated with an integration may no longer exist, or more importantly, new risks may exist that didn’t at the time of the original evaluation. It is a good practice to routinely re-evaluate integrations to maintain an up-to-date picture of your integration risk landscape.</p><h3>Common use cases</h3><p>Let’s look at a few key scenarios in which integration risk assessments add value.</p><h4>Comparing integration tools and strategies</h4><p>When comparing managed packages, evaluating middleware tools, or scoping custom integrations, risk assessment can be a useful tool for comparison. The same identified risk can be evaluated for each of a set of options and the results can be compared to determine the best approach. In addition, considering the overall number and severity of risks associated with each different solution can help determine the best approach. For example, integration tools use and store data from Salesforce in different ways. Evaluating the severity of the risk of unexpected data exposure in light of these differences can help determine which tool is best suited for your use case. Using risk assessment in this way leads to a higher degree of confidence when making recommendations and decisions regarding integrations.</p><h4>Surfacing risks with requested integrations</h4><p>When a business unit requests a new integration with an external tool, it can be difficult to effectively communicate risks that might require additional investigation or mitigation to stakeholders. It can be particularly difficult if there is a business urgency or cost associated with delaying an integration project. For example, you may discover an unexpected risk only after a considerable amount of the integration work or testing has been completed. Including a risk assessment as a prerequisite for integration projects as part of your routine architecture process can provide a more consistent and timely way to communicate risks.</p><h4>Evaluating existing integrations and re-evaluating integrations over time</h4><p>As your org evolves, the risks associated with an integration can increase or decrease in severity, new risks can be identified, and others can cease to exist. For example, you may discover that an update to a package significantly increases its API consumption putting you at risk of hitting your API limits. Performing a risk assessment routinely on existing integrations can help you uncover previously unidentified risks, divert resources from mitigation efforts that are no longer needed, and increase overall system integrity.</p><h3>Conclusion</h3><p>Maintaining system integrity is a key responsibility of every Salesforce architect. By creating a risk assessment framework and applying it to new and existing integrations you can stay ahead of unexpected system or business impacts related to your integrations and ensure they are properly addressed. Next time you are evaluating a new or existing integration with Salesforce, consider running a risk assessment as part of your process. Start with the general steps outlined above and then expand or iterate to fit the specifics of your org and process. You can use <a href="https://salesforce.quip.com/TmDCAxjkoglD?template=1">this template </a>based on the format I use to get started. Remember, the primary value is in the practice of evaluating risks and addressing them, not in the specifics of how you categorize and label them, so try different approaches until you land on what makes the most sense for you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e78b27d2deb2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-architects/evaluate-integrations-with-a-risk-assessment-framework-e78b27d2deb2">Evaluate Integrations with a Risk Assessment Framework</a> was originally published in <a href="https://medium.com/salesforce-architects">Salesforce Architects</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>