developer

  • Spring ’22 Release for Developers

    The next Salesforce release is upon us, and with a new release comes a new API version… API Version 54 to be exact. So, we take a look at the Spring ’22 Release for Developers, what are the key features and changes we need to know to be ‘release ready’?

    Let’s dive into the Spring ’22 Release, and see some of the key features heading our way which may be relevant for you and your development team(s).

    Looking for an overview of the top features? Check out our breakdown for Sales/Service/Experience Clouds.

    Spring ’22 Release: Key Dates

    The dates you need to keep in mind for Spring ’22 Release are outlined here in detail.

    Sandbox Previews have commenced, and the rollout globally should be completed within the next four weeks. With the Spring ’22 Release available for some orgs this weekend (14th Jan 22). Most orgs will receive it on the weekend of the 4th Feb or 11th Feb:

    Keep these dates in mind as you plan your org's release preview for new features and enhancements.
    Key Dates (US date format), for Salesforce’s Spring ’22 Release
    (Source: Salesforce)

    Spring ’22 Release: Enforced Release Updates

    Starting off, let’s take a look at the Release Updates which will be enforced as part of the release.

    General Salesforce Platform/Security Updates:

    Enforce CORS Allowlist for Lightning Apps
    The CORS allowlist in Setup isn’t currently enforced for Lightning apps on the server, although it’s enforced on the browser. This update enforces the allowlist on the server so that disallowed requests are blocked earlier and not processed on the server.

    Login Credentials Using URL Query Strings Are Disabled
    To improve security, users can no longer log in to Salesforce by using a username and password as URL query string parameters to the login URL. Any users who try to do so are redirected to the login page.

    Require Multi-Factor Authentication for Logins to Subscriber Orgs
    With this update, we secure access to subscriber orgs by requiring multi-factor authentication (MFA) when logging into the License Management Org (LMO). MFA is required only for LMO users who require access to the Subscriber Support Console.

    Enable Visualforce Expression Language Apex Method Access Modifier Enforcement
    When accessing Apex methods defined by custom controllers, the Visualforce Expression Language doesn’t correctly validate the access modifiers of the method. Developers can sometimes access unauthorized data on managed and system classes. To improve security, this update validates the Apex method access modifier and throws an error if the Visualforce Expression Language can’t access it.

    Product Specific (CPQ):

    Get Ready for Browser Performance Improvements for Salesforce CPQ (Release Update)This update allows Salesforce CPQ to run faster in supported web browsers by employing new Web Components V1 technology.

    Plan/Roadmap for Summer ’22:

    And looking forward, remember to also review and start preparing for the enforced Release Updates in the Summer ’22 release, which is due for release around mid June 2022 for most orgs.

    The key Release Update that is planned for Summer ’22 is the retirement of legacy APIs – this will only impact older orgs. But the headline: if your org is using API version 7 to 20 for SOAP, REST, or BULK APIs – you’re going to need to plan and make changes before the Summer ’22 release.

    Spring ’22 Release for Developers: Key Features/Changes

    Now let’s turn our attention to some of the new features being introduced.

    This list is in no particular order and I am focussing more of general platform items that may apply more broadly. So product specific changes for Marketing Cloud/Wave/etc aren’t listed, as always please refer to the Release Notes for a complete list.

    Workflow Rules & Process Builder Phased Retirement:

    As per the announcement last year that Process Builder and Workflows will be retired. Salesforce has launched a beta of the new ‘Migrate to Flow’ Tool, aimed at helping Admins and Developers migrated existing Workflows to Flow.

    Spring 22 Release: The workflow rules page in Setup, with a banner asking you to consider migrating your rules to flows.
    Spring ’22 Release for Developers: New banner in Workflows, and accessing ‘Migrate to Flow’ tool
    (Source: Salesforce)

    Lightning Web Components (LWC):

    Enable Third-Party Integrations with Light DOM

    There is a new beta feature being introduced to give developers and integrations more control of the DOM. Salesforce is introducing the ability to render LWC via the Light DOM. By default Salesforce LWCs render in the Shadow DOM which presents developers some challenges re: global styling and third-party integrations.

    With this beta, we can now set the renderMode static field in your component class.

    Read the release notes for this beta feature here – as they outline how to use this new feature, and highlights a number of considerations about when you should/shouldn’t use it.

    Secure Your Components Better, Stronger, Faster with Lightning Web Security

    The Spring ’22 Release also sees Lightning Web Security (LWS) become ‘generally available’.

    Lightning Web Security aims to replace Lightning Locker for Lightning web components. LWS works along with Lightning Locker, which is still used for Aura components.

    Session Settings page with selected checkbox for Lightning Web Security (LWS)
    Spring ’22 Release for Developers: Lightning Web Security is generally available via Session Settings
    (Source: Salesforce)

    LWC – New Module:

    lightning/uiRelatedListApi (Beta)

    This new module includes new wire adapters to get records, metadata, and record count for a related list.

    • getRelatedListRecords—Returns record data for a related list.
    • getRelatedListInfo—Returns metadata for a related list.
    • getRelatedListsInfo—Returns metadata for multiple related lists.
    • getRelatedListCount—Returns the record count for a related list.

    LWC & Aura – Changed Components:

    LWC: lightning-datatable 
    Aura: lightning:datatable

    This component introduces a new method openInlineEdit() allowing developers to programmatically change an editable focused field to edit mode from an external element such as a button. There are also some additional column properties introduced in this release.

    To see this change in action, you can pop over here to read more.

    Apex:

    The Schema Namespace also includes a couple of method additions to the DescribeSObjectResult class:

    • getAssociateEntityType() method returns an associated object of a specified parent but only if it’s a specific associated object type
    • getAssociateParentEntity() method returns an associated object but only if it’s associated to a specific parent object

    The example provided in the developer documentation highlightsAccount &Account History: Invoking the method on AccountHistory returns the parent object as Account and the type of associated object as History

    Also another addition of note is relating to the System Namespace.

    With a number of new Classes and Methods added in this release to help with hostnames and domains which are used within your org. This will reduce the need to create ‘workaround’ methods to calculate domain/hostnames when dealing with Lightning, sandbox names or Experience Cloud hostnames from within an org.

    • System.Domain class:
      getDomainType() method returns the type of domain
      getSandboxName() method returns the name of the associated sandbox.
    • System.DomainCreator class:
      getLightningHostname() method returns the hostname for your org’s Lightning pages
      getExperienceCloudSitesHostname() method returns the hostname for the system-managed domain for your org’s Experience Cloud sites
    • System.DomainParser class:
      parse(hostname) method to parse a Salesforce owned hostname for your org, such as MyDomainName.my.site.com
      parse(url) method to parse a Salesforce URL for your org, such as https://MyDomainName.my.site.com
    • System.Test class:
      As mentiond below in Security, there is a new method introduced calculatePermissionSetGroup()

    SOQL:

    FIELDS() function

    There is a change to improve the consistency of results and reduces errors when using this function in Apex.

    Security Related:

    • Enable Stronger Protection for Your Users’ Personal Information
      Enable Enhanced Personal Information Management to prevent external users, such as portal or community users from accessing other users’ personal information.

      This feature, which replaces the Hide Personal Information setting, secures more personal identifiable information (PII) user record fields. You can also decide which custom and standard user fields are considered PII.

      This update is available in Spring ’22 under Release Updates.

    • Create HTTPS Hyperlinks by Default
      When you save content in Salesforce that contains a URL without a protocol, Salesforce converts it to a hyperlink by assigning the HTTPS protocol. For example, if you type example.com in a Chatter post, Salesforce converts it to https://example.com when you save the post. Previously, Salesforce assigned the HTTP protocol for hyperlinks. If a link requires the HTTP protocol, enter the http:// prefix as part of the URL.

  • Getting started with VS Code for Salesforce

    So confession. I am like using and am quite comfortable using the Force.com IDE/Eclipse and even Developer Console when I do dev work. Have I used VS Code for Salesforce before? Nope! Force.com IDE is my go-to and I have been using it for a number of years…

    But as you may have picked up, Salesforce has been starting to push users to switch over to VS Code with the retirement of the Force.com IDE v2 beta in Spring ’18 release.

    Additionally to develop with features like Salesforce DX, you need to switch to VS Code. So let’s take a look at what VS Code is, how to get it setup and how to deploy your first class to a sandbox…

    What is VS Code?

    Firstly, if you haven’t heard of VS Code (or Visual Studio Code). It is a light-weight, open-source, code editor. And it is optimised for building and debugging modern web/cloud applications.

    The core features include:

    • Intelligent code completion
    • Syntax highlighting
    • Embedded GIT control
    • Support for debugging
    • Extendable via plugins/add-ons (which is how Salesforce comes into the picture)

    It is a free tool to download, and runs on most major Operating Systems (Windows, Mac, Linux). And isn’t based on Java, instead using the Electron framework to build cross-platform desktop support, essentially using web technologies.

    Most importantly, don’t confuse it with Visual Studio which is used primarily for .Net related programming languages and is only available on Windows.

    What’s behind the change?

    Well, the simple answer, is that VS Code was an easy platform to use, to give Salesforce the Command Line interface needed for Salesforce DX development via a VS Code plug-in.

    But personally I feel, there is a bigger motive behind what we are now seeing over the last year or two for Salesforce re: platform development (and features like Salesforce DX becoming available)…

    Most Dreaded Platform…

    See, historically Salesforce has been receiving overall negative reviews from Developers, and has typically featured in the top 5 (if not the top position) of ‘most dreaded’ lists from yearly developer surveys on sites like StackOverflow.

    As seen in the 2015 Developer Survey, Salesforce achieving the infamous achievement of ‘Most Dreaded’ platform.

    The surveys since don’t fare much better, including the latest 2018 survey with Salesforce in the top 3 ‘most dreaded’…

    Personally, when talking to a number of .Net developers over the years, I am not surprised by these results. Even though APEX is similar to other languages, there are a number differences between developing for a cloud-based platform like Salesforce vs a .Net application. And there needs to be…

    But things like Salesforce governor limits, take on a huge focus when developing for Salesforce (hello, bulkification), and it does force you to think differently about how you solve a problem. But I digress…

    Additionally, the fact most developers don’t use Eclipse as an IDE… But instead prefer to use VS Code as a development environment, we can start to see why Salesforce is heading in the direction it is:

    VS Code ranks as #1 favourite Development Environment for Web Developers.

    Additionally we are seeing a renewed focus from Salesforce on improving the overall development experience over the last few years. Features like Salesforce DX/scratch orgs, Lightning Components (using more standardised web-development languages, eg Javascript) and now with Spring ’19, Lightning Web Components.

    Salesforce is clearly making a play to smooth the development experience for developers, primarily for other web-platform developers, who aren’t familiar with Salesforce.

    Why? Well, in my opinion by implementing a way to allow someone to develop on Salesforce, but with no specific Apex/Visualforce knowledge, they are growing the overall developer market and making the platform more flexible overall for developers.

    What does VS Code offer Force.com Developers?

    So that is it for the history lesson part of this write-up! Now let’s take a look at what VS Code might offer us Force.com Developers who are used to Force.com IDE…

    The main take-aways for me out of the video are:

    • Track changes easily to source XML
    • Replay Debugger, being able to ‘step through’ the code now and see variables at runtime, all based on the debug logs. This is relatively new thing for Salesforce, but is common in other development languages. And will streamline how you handle debugging of processes
    • Support for Scratch Orgs vs ‘normal’ Sandboxes/Production
      • Scratch Orgs give you a disposable/throw away development environment and can be spun up instantly. (Think Salesforce DX).
      • Package Development Model, is similar to what you are probably used to in Force.com IDE, allowing you to push/pull into development/trial sandboxes or production environments.

    How-to Guide: Getting Started with VS Code

    So let’s go…

    When I was trying to install and get my development environment setup I had to jump around to multiple sites to try and figure out how everything works together. So I am trying to collate this all into one spot as I learn myself…

    But please note, as I am going through and teaching myself about VS Code and writing this, there may be quicker ways to do things. If you have any of these tips, please feel free to add them in the comments section at the end of the article!

    Welcome to VS Code...  Your new development environment.
    Welcome to VS Code… Your new development environment.

    Gettings Started #1. Installing and setting up VS Code

    Downloading and installing VS Code

    First up, you will need to download VS Code. I will assume your machine can handle VS Code… And it is free and available to download for Mac/Windows/Linux from here.

    Setup VS Code for Salesforce

    You will also need to install the Salesforce CLI package, as the Salesforce extensions for VS Code (the next step) require this package to be installed on your machine. So jump over to here to download and install it.

    Salesforce Extensions

    The final step to getting VS Code up and running, and before we start on our first project, you will need to also install the Salesforce Extensions for VS Code.

    These are freely available in the VS Code ‘marketplace’ (think the App Exchange for Salesforce, or Chrome Web Store for Chrome Extensions).

    Click here, and click the green ‘Install’ button. You should then be prompted to open the link in VS Code. You will then see another pop-up with ‘Install’ button. Click it, and then VS Code should install/restart.

    Other Extensions

    There are a number of other Salesforce related extensions available. I won’t cover them here, but you can easily search the Marketplace and find other relevant extensions/packs.

    This is one advantage of being an open-source platform, anyone who wants to can develop and share an extension/plugin if that wanted to…

    Learning Basics of VS Code

    To learn the basics of VS Code, Microsoft has a ‘Get Started’ section on the VS Code website. These video cover the basics of:

    • Navigating around VS Code
    • Debugging
    • Using Intellisense (the code completion/suggestion feature like Content Assist in Eclipse)
    • Version Control (using VS Code with GIT)

    My first impression was a little confronting. This might not be the case if you are use to command line development (CLI), but after coming from Eclipse where most things are point and click, it was a little bit of ‘gee, what do I do now?’

    The main thing to learn and start to get comfortable with is the Command Palette, as this is how you will navigate and access the commands within the tool:

    command palette
    VS Code: The Command Palette

    I would urge you to take a look at the Tips & Tricks page from Microsoft on VS Code too. It includes print outs of the keyboard shortcuts and a number of other useful details.

    Getting Started #2. Creating your first Project

    There is a useful Wiki published on the Salesforce DX Github page, and it outlines the types of projects you can work (scratch orgs vs developer/trial sandboxes/etc) and how to get started with the various Command Palette commands.

    The two models you should be aware of (sourced from the below guide on GitHub) are:

    • Org Development Model – which is similar to what you are probably doing now if you use Force.com IDE. And is where you connect to an environment (eg Sandbox, Developer, Trial, or Production org) and then develop/deploy code directly into that environment.
    • Package Development Model – is the second type of development model and this is where you would ultimately connect to a scratch org for development. To read more about this, click here.

    The commands you use in the Command Palette will depend on the development model you are trying to setup and code with… There is a full guide for both development models here.

    But for the purposes of this post though, I am going to setup and connect to a Developer Sandbox via the Org Development Model.

    Open the Command Palette

    To get started, open the Command Palette (on a Mac, which I am using press CMD+SHIFT+P), and in the Command Palette type in:

    SFDX: Create Project with Manifest 
    Command Palette: SFDX: Created Project with Manifest

    Then, the Command Palette will ask you for the name of your project, so type in a Project Name and press enter. I am just calling this ‘My First Project’ for this guide…

    Command Palette: Enter the Project Name

    Then you should get a pop-up window asking you to confirm the location to save it on your local machine. (This is similar to the Workspace location in Force.com IDE).

    In the pop-up window, confirm the folder location and click ‘Create Project’:

    Choose your Project folder location

    You will then see your Project open in the Explorer (on the left hand side):

    Explorer: ‘My First Project’ is now ready to start…

    Getting Started #3. Find your sfdx-project.json file

    This file should have created as part of the project, and is where you store the configuration information, like which environment you want to connect to.

    You can read more about this file here or here.

    For this demo, I will update the URL to login to a sandbox to https://test.salesforce.com, and save the changes to the file:

     "sfdcLoginUrl": "https://test.salesforce.com",
    Project: Editing sfdx-project.json file

    Gettings Started #4. Let’s get connected…

    We need to start the process of essentially connecting and logging in to the environment we want to login to.

    Now, open up the Command Palette again and type in:

    SFDX: Authorize an Org

    As you type, you will now see a number of new SFDX commands available too. But for now, just select the Authorize Org option and press enter.

    Command Palette: Authorize an Org

    The Command Palette will then prompt you for which environment type to login to. You can select ‘Project Default’ as we already updated the sfdx-project.json file already.

    Setting up a Project: Select Project Default

    And then you will also be prompted for an Org Alias, you can press Enter and accept the default name, or specify a custom alias.

    Setting up a Project: Select an Org Alas

    Now, VS Code and the Salesforce Extension will open up your browser and take you through the normal login flow. In this example, I have Lightning Login also setup (just to demo that this also works).

    As you go through the login, if this is the first time for the environment you may also see a ‘Global Connected App’ authorisation, just click Allow.

    Meanwhile, back in VS Code, you should see a little pop-up on the bottom right hand side now confirming login has been completed:

    SFDX: Authorize an Org successfully ran.

    Getting Started #5. Retrieve your Source

    Now we are authorised, we can go ahead and look and downloading our source components.

    You will need to first check you package.xml, which is where information on what to download/retrieve is stored. You can find the documentation on the .xml file here.

    But imagine this step, being similar to Force.com IDE where you select which components you want to download from the environment.

    And keep in mind, this step is only for when you connect to a developer, trial, production environment. If you go and use scratch orgs, you won’t have to do this step.

    In the Explorer under your Project, find the folder ‘manifest’. This is where you will find the Package.xml file.

    By default, it includes the APEX components, Aura Bundles and Static Resources, but you can add to it if you wish.

    Package.xml contains what elements you will retrieve from the server.

    Now with the Package.xml ready, you can commence the download/retrieval of the elements.

    Here, instead of using the Command Palette, you will need to right-click on the file in the Explorer, and select the option:

    'SFDX: Retrieve Source from Org'
    Explorer: Right-click and select ‘SFDX: Retrieve Source in Manifest from Org’

    Gettings Started #6. Work with your code…

    You will get another little notification once it has completed downloading, and now you can navigate to the code!

    Navigate via the Explorer, to force-app -> classes -> find the Apex Class you want to work with and double click on it to open the editor. Then this part should feel very similar to Eclipse.

    Use Explorer to navigate to your Class/Trigger/Aura/etc to start working with it.

    Now you can start your coding. To use features like Intellisense (the auto-suggestion feature), you can select CTRL-Space (on Mac, though I assume similar on Windows) to up the pop-up:

    VS Code: Intellisense auto-suggestion/completion for your code

    As you you coding too, you will see in the bottom left hand side of the screen an Errors and Warning notification. You can simply toggle the Panel to display by clicking on the icon (or CMD-J on Mac).

    This Panel, then displays the Problems, Output, Debug Console and Terminal (if you need them).

    Problems via the Panel will look very familiar to you if you have used Eclipse (or Developer Console):

    Panel: Displaying Problems, like syntax issues / etc

    Gettings Started #7. Deploying your code back to Sandbox

    And finally, when you are ready to push the code back to the server. You can right-click on the class again, and then select ‘SFDX: Deploy Source to Org’.

    SFDX: Deploy Source to Org

    Getting Started #8. Deploying to Production?

    Salesforce don’t recommend using the above ‘Deploy Source to Org’ to move things into Production. Instead they advise developers to use the Packaging feature.

    For now, this is just a how to get started guide… But if you are ready to move your code to a Production environment, please read more about this over here.

    Extra Reading: Migrating from Force.com IDE to VS Code

    The final guide for you, is if you want to migrate your workspace and projects over from Force.com IDE. into VS Code

    Salesforce has included instructions you can follow, to migrate your packages into VS Code. To read more, click here.

    Wrapping up

    So this is just the start. But we have now connected to a sandbox, worked with our first Apex Class and Deployed it back into the Sandbox.

    There are a lot of other features which will be covered in another post shortly (like working with source control/repository and debugging). But for now, happy coding!

    And as I mentioned at the start of the guide, if you have any shortcuts / tips or suggestions, please add them in the comments below!

    Appendix: Other Resources

    Video: VS Code for Salesforce Developers
    Video: VS Code IDE for Eclipse Users

  • The week in review (Einstein Platform, SF ‘CRM’ stock to double? & Oracle/Salesforce agree!)

    There is a big focus this week in Salesforce Briefs on AI with Einstein Platform being released for Developer’s, with several new tools being announced.  Also in this week’s brief, how AI can help Sales Enablement, ‘CRM‘ stock to double in 3yrs and finally did you ever think you would see Oracle and Salesforce agree on something?!  I know I didn’t…

    Salesforce introduces Einstein Platform (AI tools for developers)

    Salesforce Einstein, ready for takeoff?

    The slow and steady release of Einstein across the Salesforce multiverse continues this week, with Einstein Platform being unveiled to the world.

    After Salesforce announced the Account Based Marketing AI suite last month and attention has now turned to helping out platform developers.  Who can now have access to some cool new additions such as Intent & Sentiment Analysis!

    This means developers can now start use AI to analyse comments/text to understand if it is positive/neutral/negative in sentiment or also use Einstein to analyse the intent of a request (to then help route to the correct queue as an example).

    Forbes has an article around the dawn of the ‘data developer’ here, and a quick look into where this trend might end up.

    How AI can help Sales Enablement

    Source: Heinz Marketing
    Sales Enablement.

    Firstly, the term Sales Enablement isn’t very common outside of North America.  So what are we talking about here?  Ultimately the function of sales enablement is to provide salespeople with what they need to successfully engage the buyer throughout the buying process.

    So it is a domain that is ripe for AI to help drive insights about the buying process.  We saw previously how Marc Benioff is using AI to empower Salesforce’s forecast meetings.

    The insights and trend analysis that machine learning can deliver will help to unleash productivity within any sales organisation.  And this article looks at how it will support Sales Enablement in this push towards the future.

    Salesforce (CRM) stock to double?

    One of Salesforce’s major shareholders is making bold claims about the share price having room to grow.  To watch the video, click here.  This is in no way financial advice, but interesting if it proves true…

    We all know Salesforce has been flying along recently.  But from my point of view the competition in the CRM space is about to really heat up.  Microsoft is starting to slowly find its feet, Oracle is not to be underestimated and SAP is also in the pack…  Not to mention all the yappy upstarts like Pipedrive, Zoho, etc.

    The CRM playing field is about to get very crowded.

    Oracle, Amazon, Google, and Salesforce finally agree on something…

    Ellison vs Benioff
    Ellison vs Benioff (Source: zdnet)

    (I loved this headline from The Register!  It really hit the nail on the head…)

    The High Tech Innovators Alliance (HTIA) a lobby group which has been formed and is backed by eight tech giants (the above mentioned, alongside Adobe, Cisco, Intel and Dell).  Why is this interesting?  They have formed this lobby group to try and get politicians to fix problems that surround patent law currently.  Because at the moment it seems anyone can sue anyone.  With the aim to make it more difficult for patent trolls to sue them and others.

    Hopefully this doesn’t stifle innovation, but instead affords innovators correct protections for their ideas.

     

Back to top button