Microsoft-Azure-Functions-for-Salesforce
This project was driven by the desire to extend Salesforce with scalable functions for use cases that the platform Apex language are generally too limited for.
Salesforce has releaseed a Functions framework in Winter '22, however access to the product is difficult. Microsoft on the other hand provides free trial to most Azure services just by signing up, and with clear pricing as well.
This is the Quickstart Salesforce Function walkthrough which you can deploy to Azure and:
- Insert an Account into Salesforce.
- Check if a PDF file in Salesforce is password protected
This project will be regulary updated with new utilities than leverage the benefits of Functions in Salesforce:
Comparing Microsoft Azure functions with Salesforce you can see multiple benefits that are worth considering:
New technology in the Salesforce suite, but training will be targeted at existing Salesforce developersArea | Salesforce APEX | Salesforce Functions (Winter '22) | Microsoft Azure Functions (4.x) | Comments |
---|---|---|---|---|
Product access | Part of free Salesforce Developer Org | Contact your Account Executive | Signup online anytime | You can use Microsoft Azure anytime. Salesforce requires an account level conversation. |
Pricing | None (included with Salesforce ecept for most basic editions) | Public pricing is USD $2,000 per org per month for 235k API calls, with increments of $45 for additional capacity on top of that. | Public calculator. First 1M executions free. Salesforce API calls will cost extra if you exceed your standard limit. | This is a very difficult comparison, and needs more investigation. On the face of it Azure is much cheaper, however you will also need to consider OPEX costs in maintaining it as well and current Salesforce API usage as well. For significant API usage then Salesforce Functions may well work out cheaper. |
Development Tools | VS Code or Developer Console | VS Code + Docker Desktop | VS Studio or VS Code | Salesforce uses Docker Desktop for running Functions locally. This now requires licensing Docker for most customers. |
Usage | Anywhere | Salesforce Functions can likely be invoked from anywhere (TBC) | Azure Functions can be invoked from anywhere | It could be an advantage with Azure to abstract your functions from the Salesforce platform and reuse them elsewhere. |
Languages | Apex ('Java-like') | Java, Typescript/Javascript | C#, F#, Python, Java, Typescript/Javascript, Powershell | Azure offers the widest range of options |
Skills | Simple Java knowledge | Developers will need to pickup new Microsoft Azure skills. | Salesforce has the advantage of having everything on one vendor platform. It is challenging to find for Salesforce developers with Microsoft Azure skills. | |
Memory limit | 6MB (12 MB in some circumstances) | 1GB | 1.5GB (other plans can go up to 14GB) | If your compute functions really need more than 1GB of memory, then you need to consider another option. I would imagine increasing this ammount is on the Salesforce roadmap. |
Salesforce API | Built in | Salesforce Functions have in-built platform API's | Azure Functions can access Salesforce using the SOAP or REST API | Salesforce has the advantage of having an API tightly integrated with the Salesforce platform |
Platform maturity | GA 2006, and reliably used ever since | GA in 2021 - Winter '22 | GA in 2017 - on version 4 | Microsoft functions is now quite a mature product, and Enterprise ready. |
Pre-requisites
- Salesforce Developer account (free) - https://developer.salesforce.com/signup
- Microsoft Visual Studio 2022 Community Edition - Preview (free) - https://visualstudio.microsoft.com/vs/preview/
- Microsoft Azure account (free) - https://azure.microsoft.com/en-us/free/
Optional
- Postman (or similar API tool) - https://www.postman.com/
Setup Steps
- Publish Function solution to Azure
- Ensure the following Appliction Configuration settings for your Salesforce org are set:
Notes
- This is built in .NET 6 preview, just because the framework is planned for release this November 2021, and the performance aspects will be important for potential comparisons with other providers such as Amazon AWS and Google.
- There is a very specific bug when generating the .NET wrapper around the Salesforce Partner API. The simple fix is here: https://stackoverflow.com/questions/60976792/net-core-3-1-soap-platform-not-supported-error-compiling-jscript-csharp-script
- I built this all on Windows 11. It should be possible on Mac OS with the same tools.