• SalesforceChaCha
  • Posts
  • ๐Ÿ’ƒ Do the impossible with Salesforce Functions๐Ÿ•บ

๐Ÿ’ƒ Do the impossible with Salesforce Functions๐Ÿ•บ

What even is this feature ๐Ÿค”

Good morning, Salesforce Nerds! Raise your hand if youโ€™ve been burned by a governor limit! ๐Ÿ–๏ธ๐Ÿ–๏ธ๐Ÿ–๏ธ

As Salesforce professionals we all know the havoc that these limits can unleash for our teams. ๐Ÿซ  They can be SUPER difficult to troubleshoot & root cause. Not to mention they can stop an implementation in its tracks if theyโ€™re not accounted for early. ๐Ÿ›‘ 

As requirements pour in from the business (with no concern for our plight ๐Ÿ˜ญ), it helps to know what tools our favorite SaaS provider ๐Ÿคฉ has made available that allow us to:

โœ… Meet those computationally heavy ๐Ÿ‹๏ธ business requirements

โœ… Give the finger ๐Ÿ–• to some governor limits

โœ… Play ๐Ÿ› with some cool tech ๐Ÿ˜Ž 

Agenda for today includes

  • Do the impossible with Salesforce Functions

  • Daily Principle

  • All the Memes

Do the impossible with Salesforce Functions

โ“๏ธ What are Salesforce Functions?

If you check out the official Salesforce Function dev guide youโ€™ll read that Salesforce Functions allow you write code that executes โ€œoutsideโ€ of your org. ๐Ÿคฏ ๐Ÿคฏ 

Huh? So, wait โ€ฆ we write Apex that executes outside of our org? ๐Ÿค” 

Partly correct. It does run outside of your org! ๐Ÿฅณ But, itโ€™s not Apex! ๐Ÿ˜Ÿ 

Salesforce Functions currently support Java, JavaScript, and TypeScript. ๐Ÿ’ฅ Meaning, your team(s) can now use an industry-standard language to create even more valuable experiences for your business! ๐Ÿ”ฅ๐Ÿ”ฅ

These functions are deployed to, and execute in, a secure Salesforce-managed infrastructure that is separate from your Salesforce org! ๐Ÿง  

Since they execute outside of your instance - they bypass governor limits! ๐ŸŽ‰๐ŸŽ‰ 

โ“๏ธ How do I use Salesforce Functions?

Pretty simply, actually. ๐Ÿ™ Kind of like an AWS Lambda Function tbh.

Use VSCode to develop your function, deploy it to the Salesforce Function Infrastructure, invoke it. Easy, peasy, ๐Ÿ‹-squeezy, right?

Yeah, youโ€™re right. Thatโ€™s super high-level and very happy-pathy, but those are the steps! ๐Ÿ’ฏ Validate it here!

At the end of the day, the function itself is included in your project files ๐Ÿ“‚ (with your Apex, LWC, VF, etc.), but itโ€™s deployed into a managed environment that is accessible via your org with Apex or Flows! ๐Ÿ‘€ 

Itโ€™s effectively a Function-as-a-service (FaaS) that you can call from Salesforce and it can call back into your org natively! ๐Ÿคฏ 

โ“๏ธ When do I use Salesforce Functions?

Theyโ€™re perfect candidates for computationally-intense tasks that you just canโ€™t do with Apex. โœ… 

Think of those governor limits that can keep you up at night when youโ€™re working on a solution. ๐Ÿ›Œ These may be a good candidate to refactor into a Function.

Need to do read a large CSV file ๐Ÿ“ƒ and stream the contents into an Object in your org? A Function can do that. Maybe upload an image and resize it before saving it as a ContentVersion? Salesforce Functions to the rescue! ๐Ÿฆธ 

There are TONS of use cases. Really, any computation that would blow up a governor limit ๐Ÿงจ or is technically impossible on the platform (see the file examples above ๐Ÿ‘†๏ธ) may be better a Function.

โ“๏ธ Where do I get more information?

For sure, check out the Developer Guide! Itโ€™s packed with goodies - Quick Start, Samples, Architecture Overview, etc.. ๐Ÿ˜‹ 

The Salesforce team has also provided some good, short videos on YouTube to demo and discuss details. Hereโ€™s one. Hereโ€™s another. This one is probably my fav. ๐Ÿ’“ 

Happy coding, fellow Salesforce Nerds! ๐Ÿค“ 

Daily Principle

"If you are ever tempted to look for outside approval realize that you have compromised your integrity. If you need a witness, be your own."

Epictetus

and now....Your Daily Memes

What did you think about today's newsletter?

Login or Subscribe to participate in polls.