This Groovy introduction post is all about what you need to know about Groovy before you start your coding experiments.
As any changes made using the Sales Cloud, when enriching your extensions in App Composer with Groovy, this can only be done within the context of a sandbox.
Lots of resources and documentation on Groovy are googalable, but Sales Cloud comes with documentation on how Groovy can be used in App Composer also. This documentation contains lots of other examples complementing the ones that I will share in this series.
In order to make your first attempts to Groovy programming easier, the Groovy expression editor comes with a ‘function palette’. It can be used to quickly access predefined functions or to refer to object fields that you might need in your code. Alternatively you could learn all of these by heart, but why would you 🙂
The example below is the function palette that shows when adding some code to the opportunity object. I can use any of the opportunity fields in my code, or any of the fields of any object related to opportunities: accounts, leads, … Use the ‘insert’ button at the bottom to insert the field names in your code.
Do not forget to validate your code before submitting it 🙂
Groovy For Dummies
In the rest of this series, I will share code snippets from easy-to-implement to i-need-a-real-programmer-for-this:
- One-liners: what can be done without much programming experience and just 1 line of groovy code
- Five-liners: what can easily be done with just 5 line of groovy code
- Too-many-liners: what else can be done with more advanced Groovy code. You do not know how to do all of this, you just need to know what is possible and be able to find someone who can do it for you !