I am trying to learn about these two annotations that has been introduced as Spring 15 release. Can anyone please explain why and under what circumstances do we need to use these two annotations. An example would be great.
Thanks in advance.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
As per the Spring 15 release notes. @InvocableMethod exists to make it easier for a flow to call a method on an Apex class. It has some limitations around the supported data types that can be passed to the method, but should be simpler than implementing the Process.Plugin Interface
Have a look at the example in the release notes that demonstrates getting the account ids by name. The @InvocableMethod is much shorter (11 lines to 28) and more straight forward to follow. As noted, the shorter version is also more efficient when dealing with multiple records.