Typescript function edits only one of ontology object type specified in the Edits decarator

My typescript function executes an action in the workshop app which is expected to update 2 ontology objects - ES BOM Line Item and Production BOM Line Item. I have specified both the ontologies in the Edits decarator. One of the function parameters is line_item which is of type ES BOM Line Item. I am able to modify values to properties of line_item object which is reflected in the ontology as well.

However, the modifications applied to the Production BOM Line Item objects are not applied to the ontology even though I am able to view the changes using the ‘live preview’ feature of the functions. I am using Objects.search() to retrieve the object instances of Production BOM Line Item and applying the modifications to those properties. This works properly for other functions.

Can a function backed action edit only one object at a time? I fail to understand why I am unable to update the Production BOM Line Item objects. Any help is appreciated!

Hey,

Function-backed actions can modify multiple objects (even of different Object Types) at the same time, provided the function does not take longer than the enforced limits (60 seconds I believe) to fully execute (in which case none of the edits – even to those that were within the first minute of execution – actually get committed).

  1. Are you seeing any error messages when you trigger the function-backed action?
  2. Is there a link type between the ES and Production Object Types? If so, depending on how it’s constructed you may want to use the Link Type APIs (objectA.objectTypeB.get() or objectA.objectTypeB.all()) instead of the standard Objects.search() notation to make sure you’re attempting to edit the correct objects.