Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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
Solved! Go to Solution.
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.
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.
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.