Diving into Developer Updates from Dreamforce 2021

Alan Petersen

Dreamforce 2021 was different in many ways this year, from the decreased in-person attendance numbers to the continued prioritization of delivering sessions virtually. One thing that definitely did not change was the number of important, insightful sessions about the future of Salesforce. From the keynote address and the opportunities for trailblazing and connecting to the campfire sessions and other presentations, Dreamforce 2021 had something for everyone. 

In this blog, I’ll share some of the key updates shared at Dreamforce related to Salesforce Developers. Unified CLI and Salesforce Functions were hot topics this year, and here’s what that means for your own solutions.

Salesforce Unified CLI

Salesforce wants to bring together various command-line interfaces (CLIs) into a unified CLI that will provide cross-cloud functionality, supporting Salesforce, Heroku, Commerce Cloud, and MuleSoft. This new executable called sf will provide a command line taxonomy for a single set of tools to write and deploy across all the Salesforce applications.

One change from the current Salesforce CLI (sfdx) is a more intuitive naming structure for commands. No more colons! And commands are simplified, so to authenticate with a Salesforce org, you would use the command sf login rather than the more cumbersome SFDX equivalent (sfdx force:auth:web:login).

The new unified CLI can be obtained from here: http://sfdc.co/demo-cli. Don’t worry, it will co-exist with your existing command line tools, so you can start exploring the new tools without interfering with your current work.

Salesforce Functions

What are Salesforce Functions?

Salesforce Functions are code, written in the language of your choice (Java or JavaScript) that can be called from your Apex code to perform operations. The main use cases are: 

  1. Doing things that are difficult or impossible to do in Apex code (for example, image manipulation)
  2. Performing complex operations that tax the governor limits when you try to do them in Apex (for example, complex processing, multiple callouts to services or manipulating data that takes up more than 6MB of memory).

Functions have the promise of really opening up the types of things that can be done with Salesforce. They can be invoked either synchronously or asynchronously anywhere Apex code can execute. This includes batch jobs, Apex triggers, platform event subscriptions, and Apex actions within flows.

The Power of Elastic Computing

Your Salesforce functions, when executed, run in a Heroku container. The best news is that API limits in your Salesforce org are adjusted to ensure that Salesforce Functions can scale. There are still limits to keep in mind:

  • Max response timeout for synchronously-invoked Functions: 2 minus
  • Max number of asynchronous Function invocations from Apex: Unlimited
  • Max number of synchronous long-running (>5s) Function invocations: 10 per org
  • Function execution time: 15 min
  • Process memory: 1GB
  • Payload size: 6MB synchronous, 12MB asynchronous
  • Response size: 6MB synchronous, 12MB asynchronous
  • Number of API calls from Function code to Salesforce org: 235,000/24h
Enabling Orgs for Salesforce Functions

In order to use Salesforce functions, they must be enabled in your Dev Hub org. You will find the setup screen under Feature Settings > Functions

Developer Dreamforce Updates 2021

Currently, you need to talk to your Salesforce account representative to have Functions enabled. Soon, developer orgs will be available where you can start experimenting with Functions.

Generating a Function

The CLI has a command to generate the basic scaffolding for a Salesforce function:

sf generate function –function-name MyFunction –language mylanguage where mylanguage is either java or javascript.

You will need the SDK (Node.js or Java) installed on your system to develop and test your function locally. When ready to deploy, the command sf deploy functions -o MyOrgAlias is used to deploy the function to the org. The first deployment can be slow, as the full container image needs to be uploaded, but subsequent deployments will be faster.

When Can I Start Using Them?

As of October 12, 2021, Salesforce Functions are now Generally Available. Make sure you check out the developer guides on Salesforce Functions for everything you need to know to get up and running: https://developer.salesforce.com/docs/platform/functions/guide/index.html 

Check Out Other Dreamforce 2021 Insights

Read More