Editing Ontology and Returning Something in Same Function

Hi everyone, wondering how can I conditionally update a property of a set of objects and return the set of updated objects from a single TypeScript function in Foundry, given that ontology edit functions must have a void return type and cannot return values? What are the best workarounds or recommended patterns for chaining edits and returning results in Automate or similar workflows? The reason I want to do this is in subsequent steps, I would like to reference the ontology with previous edits materialized.

The blunt solution would be to chain automates that listens for changes in that property, but ideally I would rather chain actions than creating more automates. If anybody has an idea how best to do this, I would appreciate it!

There is a lot to Explorer here. It is true that the ts functions must return a void. However, you can still put everything into a Single Action by chaining your logic within your function.

Alternatively, you could put a label, e.g. a transaction uuid on the edited objects that you provide via a function argument so you can filter for them subsequently.

AFAIK, if you use a Button click to execute the Action in Workshop, you should be able to define at the bottom of the configuration an optional objectset that contains all objects created or edited from the Action.

Sometimes, I would also like to mix editing with returning values, however this is often considered as an antipattern - functions should have either side effects OR return values. Not both.

I hope this helps.