Salesforce Fact #408 | Reuse method invoked from flow and LWC

Suppose we have a similar method logic which gets called by LWC and Flow. Now, we can create two different methods since LWC expects @AuraEnabled(Cacheable=true) annotation, whereas flow allows @InvocableMethod annotation.

But we can simplify this by keeping the logic in the method annotated with @InvocableMethod and calling this method from the other method. This avoids writing redundant code and keeps it simple.

Attached is the screenshot.



Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow