Skip to main content

I've encountered a problem and need some help understanding the workflow architecture, specifically when a workflow is invoked by an event. I'm focusing on synchronous workflow invocation only.
 

Diagram from documentation 


Problem: I've noticed a difference in behavior between using Error_SYS.Record_General() in an Execute Online SQL event action and IFS Failure in a workflow event action (in my experiment, both are exclusively called by the same event). It seems Error_SYS stops the process, while IFS Failure in the workflow doesn't stop the process, and I can see more activities (Server Trace) in the DevTool log. Additionally, some data are changed despite the validation error message appearing.

This issue is connected to the functionality: Report Picking of Pick List Lines -> Report Picking of one line with serial number. Report_Picking_Of_Pick_List_Lines_SVC.Do_Pick_Selected(...).


Context: For every event, a database trigger is created, and it invokes the workflow if I understand correctly. I imagine it is done in a similar way to other event actions like SQL actions, Emails, and so on.
 

Questions:

  1. How do we invoke the workflow from PL/SQL code? In the code Bpa_SYS.Append_Event, it looks like it is adding some workflow to the collection only. I do not see any direct invocation.
  2. If I do not see direct invocation of the Camunda Engine from PL/SQL, does it mean we use asynchronous communication in this case? How can we assure a single transaction? I have tried to read the documentation, but it doesn't answer my question.

 

I have the feeling that the workflow is being invoked with a delay (light async), but it should be run synchronously.

Understanding this would help me troubleshoot this and other issues.

 

Any insights or explanations, especially from the R&D team, would be greatly appreciated!

Additionally, I have conducted a simpler experiment in the Part Catalog (Master Part).


Here is what I can see in the log using Validation by Online SQL and Error_SYS:



And here is what I can see in the log using Validation by Workflow:

 


 Hi ​@Tomasz Grzebula,

These are the answers for your questions

  1. When an event trigger is fired, if the type is workflow, then the workflow and parameters are logged in the oracle session. In the same transaction, Odata checks the oracle session if there are any logged workflows. If there are any, these workflows are executed from OData side. That’s why you couldn’t find any execution logic in the PLSQL side.
  2. No. Executions are not asynchronous. They are synchronous,  in the same transaction of the Event triggering OData call. When OData receives an http call, it checks for projection before and after workflows. If found, they are executed first. Then OData checks for PLSQL side session for workflows that needs to be initiated because of an Event action. If found, they are executed next. Invoking transaction completes only when all of the above are completed successfully. If any of them gives an error, whole transaction will be rolled back.

Additionally, assume if the OData receives an HTTP call, which calls an action in PLSQL side, which calls other action chain as well. In this scenario, if the event is triggered by some db change in the first action, still the workflow will not start immediately. Workflow will start only after the initiating action chain is completed.


@Buddhi Gunasekara , Thanks for your answer. Additionally, I have conducted some experiments. Please let me know if I understand them correctly.

Let's assume we have:

  • A call to the projection Package_SVC.Procedure().
  • Inside, there is an update tab1.
  • On tab1, there is an event with two actions:
    • SQL Event Action and
    • Workflow Event Action.
  • Additionally, we have a workflow type Workflow Projection Action 'After'.

As shown in the diagram below:
 


 

Please let me know if my conclusions are correct:

  1. SQL Action Event is called just after update tab1
  2. Workflow Event Action is registered by a database trigger but is called later (still within a single transaction).
  3. This means Workflow Event Action is executed at a different moment than SQL Event Action.
  4. When we call Workflow Event Action, the state of the database may be different than just after the update tab1.
  5. Workflow Event Action is called after Workflow Projection Action 'After'.

 

 


Reply