function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saravana RavikumarSaravana Ravikumar 

Should a method using the @InvocableMethod annotation must define a return value ?

Arun Kumar 1141Arun Kumar 1141
Hi Saravana,

Yes, a method annotated with the @InvocableMethod annotation must have a return value. The @InvocableMethod annotation defines a method that a Flow or Process Builder can invoke, and the method's return value is used to pass data back to the Flow or Process Builder.

According to the Salesforce documentation, the return type of a @InvocableMethod must be a class or collection of classes, and the class must be annotated with the @InvocableVariable annotation. The class must have one or more fields that represent the information returned to the Flow or Process Builder.

If you find this answer helpful, please mark it as the best.
Thank you.
Saravana RavikumarSaravana Ravikumar
@InvocableMethod annotation can also return null instead of a value