mitchspano/apex-trigger-actions-framework

How to test Autoloaunced flows when the expected input of record and recordprior.

Closed this issue · 2 comments

Hey @mitchspano,

This is not an issue I want to raise, rather ask for some guidance regarding the creation of the autolaunched flows. When designing the flows can you please give me some guidance regarding how to test out the autolaunched flows from the flow builder UI using the debug button. Is it possible? I see that we need to provide the current version of the record and the prior version. At the moment I am not entirely sure how you would go about this?

Also, slightly unrelated, but I see that the logic has changed since the video presentation you did regarding the Trigger Actions Framework. I would really appreciate it if you coudl explan why you have now moved away from using collections of the records and instead moved to the flows working on a individual record basis.

Thank you in advance.
James

Hello @jamesloughney,

Thanks for checking out the framework!

The reason why we switched from the record collection to the individual record and recordPrior approach was performance related - check out #56 for details. The new inclusion of the Incovable.Action class allows us to properly invoke flows in a bulkified and performant manner making the ergonomics of Trigger Action Flows almost identical to those of Record Triggered Flows - check out this blog post for more details https://www.mitchspano.com/blog/Trigger_Action_Flow

Regarding testing - just hit the debug button and select an existing record for your action. Note that it will be impossible to select a record for recordPrior that has the same Id, so some things won't be easily testable from the Flow Builder UI. I would recommend writing a formal unit test to ensure that the flow is operating how you would expect.

image

Hi @mitchspano thank you for the response. I will take a look at your blog. I have tried to read up on Invocable.Action, but the documentation I have found so far is limited. I'm still very new to this so trying to wrap my head around how it works. :)