Skip to main content
4-Participant
June 9, 2022
Solved

How to send parameters from one Integrity trigger to another in java ?

  • June 9, 2022
  • 1 reply
  • 1738 views

Hello,

 

I am a junior developer and I develop triggers in java for Integrity and I would like to know how I can send parameters from a java trigger to another. Let me explain:

I have 2 triggers, let's call them trigger A and trigger B.
My 2 triggers are triggered according to rules.
My trigger B is an automatic numbering trigger and is triggered during trigger A and I need to bypass part of the code of trigger B for functional reasons.
To do this I would have liked to send a parameter from trigger A to trigger B to have the information in trigger B when A is triggered.


I had thought of doing this in the A :


ScriptServerBean serverBean = getScriptServerBean();
Map<String, String> serverMap = serverBean.getTransactionContext();
serverMap.put("parameter", "");

 

I have the parameter information in my trigger A but I can't get the information in my B trigger, maybe they don't belong to the same transaction ?

 

If you have any clue of solution I'm interested, thanks.

Alex

 

 

Best answer by LLawton

You cannot pass context from one trigger to another, and I'm sure there are lots of reasons why you shouldn't even try. If I had to come up for reasons, I would look at multi-threading and performance in general.

The solution is to have code that is smart enough and to have a careful analysis of your trigger sequence. It sounds like B is triggered by what you did in A. Remember that B can see what you just did in A by looking at the current values of fields in the item being processed. So maybe you can pass some context that way.

We would need way more details to give you a better answer.

1 reply

LLawton16-PearlAnswer
16-Pearl
June 9, 2022

You cannot pass context from one trigger to another, and I'm sure there are lots of reasons why you shouldn't even try. If I had to come up for reasons, I would look at multi-threading and performance in general.

The solution is to have code that is smart enough and to have a careful analysis of your trigger sequence. It sounds like B is triggered by what you did in A. Remember that B can see what you just did in A by looking at the current values of fields in the item being processed. So maybe you can pass some context that way.

We would need way more details to give you a better answer.

Alex2754-ParticipantAuthor
4-Participant
June 9, 2022

Ok thank you very much for your answer, I will do it differently and pass the information through a field.
I wish you a good day.