I have a procedure that I need to be triggered from different places in my app - it involves making some changes to the data value of a Thing, calling an API, and creating a Thing based on the result. The user might be interacting with the app in a couple of different places (different screens or popups) when this procedure would be called.
Custom events, as near as I can figure, are only reusable within a single page or reusable element.
In a perfect world, the workflow would be universally triggered by data changes to a Thing. For example, any time somebody changed the field “Proposal Status” on a Proposal thing to “accepted” (regardless of where or how) a bunch of things would fire off in a workflow.
I don’t think that’s an option. API workflows can fire off when a Thing is created via a POST event to an endpoint, but that isn’t the use case.
The only way that I can think to do this is to create a hidden reusable element as a way to contain the needed workflow in a custom event, and then drop it into every page or popup when the event could happen, and then use custom states to contain data, and then use “trigger custom events from a reusable element” to fire off the workflow. This would work in all cases except when I need that logic in an API workflow, which can’t use reusable elements. BUt at least I can make the logic reusable.
Any other ideas? Would anyone solve the problem another way?