Yay! Salesforce Functions has just been launched General Availabile (GA) on 12 Oct 2021, and here's a my 2 cents on what I've learnt about it!
Serverless computing has been a pretty interesting concept in the past few years. Contrary to the literal meaning of its name, 'Serverless' doesn't mean there are no servers involved, but rather developers no longer have to worry about servers or infrastructure requirements. This allows them to focus their efforts on the code/task itself, as the serverless environment abstracts away infrastructure into a solid Application Development ecosystem/platform.
Functions are essentially modularized code/programs that does small bite-size tasks, and are usually used in a larger application that invokes/calls functions to do complex tasks. We can perhaps think of functions as pieces of lego building blocks to build a larger application.
With the concept of serverless, developers can develop code and execute functions to perform tasks on demand, and not have to worry too much about the underlying compute infrastructure. This is also probably better described as Functions-as-a-service (FaaS).
The serverless concept has the potential to revolutionize the way developers write, deploy and execute code, which can now respond to requests and process data based on events and triggers.
Developers can write code that inplements business logics that can then be assembled as building blocks in flow or integrated LWC. All developers need to do is:
- Enable functions as a feature in the organization
- Create a function in the project that will be integrated with the application
This is super exciting, as developers can run non Apex code in the Salesforce universe (hence staying within the Salesforce trust boundaries for compliance), and do all sorts of amazing stuff such as creating data model against Salesforce data, processing large data volumes etc.
Also, with Salesforce Functions, customers now can push past previously org governor limits presented with Apex.
I made a little tweak and replaced the dataset with the list of Singapore's primary schools, and I was able to easily find the nearest primary schools from my current location! This could be super useful for parents who are trying to find the nearest primary schools from their homes for Primary 1 registration exercises!
By invoking the function, it returns the list in a JSON response, or I could easily have this plotted out on a map! Pretty cool!
With Salesforce Functions, it now opens up a wide range of opportunities to deliver new experiences! I can imagine lots of developers and customers leveraging it for some of these use cases on the Salesforce platforms:
- Image resizing and standardizing before saving using 3rd party libraries
- Ease burden on complex and CPU intensive calculations and triggers to perform (asynchronous) bulk processing, especially on Salesforce data (i.e. calculate most efficient delivery routes)
- Machine learning related-work, creating models and training using Salesforce data
- Data validation and processing
In summary, here's why developers would love Salesforce Functions:
- More computational power
- Scalability to meet computational demands
- Works seamlessly with Salesforce platform and data, integrated with and accessible from within Salesforce low-code & pro-code tools
If you'd like to find out more, be sure to check out these resources: