Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By sgkalluri
Hello there,

We have two processes, A and B. The scenario is that when Process A crosses the Routing Screen (continue button screen), then a trigger in the Before Routing section of Process A would derivate process B (which is totally different from process A). This derivation is done using routeCase() of WSDL Web Services.

The expectation we had was that the triggers of process B in its own Assignment, Before Routing and After Routing Sections would get executed when process B is derivated in this manner from process A.

The observation is that this does not happen. The triggers do not get executed.

Is this an expected behavior? If so, is there a workaround? The current workaround we have is that we replicate relevant parts of the trigger code of process B in process A and ensure that process B data is updated from process A, and then the derivation execution is done from process A.

Best wishes,
By sgkalluri
Here is an update based on some experimentation...

Using PM 3.2.1...

Assume that there are triggers defined in Process B in the Assignment, Before Routing and After Routing sections.

Let these triggers be named as A1 and A2 for Assignment, BR1 and BR2 for Before Routing, and AR1 and AR2 for After Routing.

Then, the following events have been observed...
1) Derivation of Process B happens in all cases
2) If there are PMF functions in any of these triggers, then they tend to get executed

3) However, saving of data tends to follow these rules...
a) If BR1 and BR2 are removed, then only variables defined in A2 get saved to the case, along with variables defined in AR2.

b) If BR1 or BR2 are included, then variables in A1 and A2 will not get saved to the case. In this scenario, if BR2 is sequenced after BR1, then variables defined in BR2 will get saved to the case, and not the variables defined in BR1. If AR2 is sequenced after AR1, then variables defined in AR2 will get saved to the case, and not the variables defined in AR1.

c) For variables in A1 to get saved to the case, then A1 should be sequenced as the last trigger in the Assignment section, and there should be no triggers in the Before Routing Section, but there can be triggers in the After Routing Section.

d) For variables in BR1 to get saved to the case, then BR1 should the last sequenced trigger in the Before Routing Section. In such a scenario, it does not matter what triggers are defined in the Assignment and After Routing sections.

e) For variables in AR1 to get saved to the case, then AR1 should the last sequenced trigger in the After Routing Section. In such a scenario, it does not matter what triggers are defined in the Assignment and Before Routing sections.

If these events can be replicated, then at least we have a set of rules to be followed for Process B to be derivated from Process A. I hope the need for such a set of rules is not required if improvements are made in PM, or have been made in versions after 3.2.1.

Best wishes,
User avatar
By amosbatto
There is a bug with triggers in routing (which will be fixed in version 3.3.9) where the case variables don't get saved correctly. As I recall correctly, you only see the bug if you have multiple triggers during routing. Try combining the code from your triggers during routing into one trigger and see if that fixes your problem.
By sgkalluri
Thanks Amos.

The error occurs when there are multiple triggers.

I combined the multiple triggers into one, and placed the combined trigger after routing, and sequenced at the end.

This worked.

However, I have a unique scenario. The task in Process B as described in the issue derivates a parallel task on its own. So, Process A derivates Process B, which in turn derivates another parallel task in Process B.

In this situation I noticed that PMF functions like PMFSendMessage, PMFSendVariables etc. do not work properly when placed in the combined trigger in Process B. What seems to happen is that the combined trigger executes repeatedly when such functions are used.

I noticed that you had recommended saving of session variables and then restoring them. I'll be trying this out and then report the results in a day or two.

Best wishes,
By sgkalluri
An update...

I use the PMFSendMessage function for emails in this combined trigger. I use HTML code to format the email. I noticed that this HTML code seems to lead to the repeated execution of the combined trigger.

To solve this problem, I removed the section related to emails in the combined trigger. I then placed a similar code in the parent process A.

The derivation then worked without repeated execution of the combined trigger - process B being derivated from process A and process B in itself derivating a parallel task in process B.

Best wishes,

Maybe try increasing your thread stack size? Seems[…]

I use PM 3.4. Android push works while IOS push do[…]

[quote=ziadeh post_id=823031 time=1550759948 user_[…]

I have to support reports in processmaker 3.4. A s[…]