SitecorePowerShell / Console

Sitecore PowerShell Extensions
https://doc.sitecorepowershell.com/
Other
114 stars 70 forks source link

Multiple Modules using Event Handler Rules #1359

Open cjgiddings opened 1 month ago

cjgiddings commented 1 month ago

When you have multiple Modules using the Event Handlers with rules set on the Enabled Rule for the script. If any of these rules fail it will stop any other modules from executing.

https://github.com/SitecorePowerShell/Console/blob/53a7ef6203056fbd6af3572e191375c59fa80b02/src/Spe/Integrations/Tasks/ScriptedItemEventHandler.cs#L64

To test create two modules using event handlers on the save event, log the data but set different rules on when they can execute. You will notice the code does not allow the subsequence module to run if the previous module rule fails. This is an easy fix to just swap this from a return to a continue so it can continue to process the other modules it has found.

michaellwest commented 1 month ago

I wonder if we should provide an option to restore the legacy behavior or to only return for the same module.

michaellwest commented 1 month ago

Seems reasonable to keep processing scripts from other modules instead of just bailing out.