Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
#5607
Hello, i'm using ProcessMaker since 2 month, and i have a question.

In every process, i have to retrieve the user's informations, that's why i learnt how to use the triggers.
I want to know if it is possible to reuse the triggers in another process (i have around 600 process to code, and it's mean a lot of triggers to copy/past)
So if you have a trick to get back the triggers or with a different way, it could be great !

Thank's for your help !
#5621
There is no way to directly reuse triggers from different processes. You will have to manually copy and paste the code into a new trigger in each process. However, you can reuse code by creating an external file and importing it into each trigger.
Store your code in your public_html directory and then import it into your trigger with an include statement.

Here's an example:
I create a file named:
/opt/processmaker/workflow/public_html/myfunctions.php (in Linux/UNIX)
or
c:\Program Files\ProcessMaker\apps\processmaker\htdocs\workflow\public_html\myfunctions.php (in Windows)
With the contents:
Code: Select all
$foo = 100;
function bar()
{
    return $foo + $foo;
}   
Then I can import this code into my trigger:
Code: Select all
include "http://<IP-ADDRESS>/myfunctions.php";
$x = $foo * bar();
#5635
amosbatto wrote:However, you can reuse code by creating an external file and importing it into each trigger.
Store your code in your public_html directory and then import it into your trigger with an include statement.
I have been using this approach for quite a while, and for the most part it works great.

However, it doesn't seem possible to work with case variables in an included PHP file. Trying to assign a value to one produces an error which states "syntax error, unexpected '='". I've tried using eval() with the same results.

Is there any way to work around this?
#6139
amosbatto wrote:I don't know any way to make case variables work in an included file. I doubt that it is possible, but I'll ask the PM developers on Monday.
Thank you Amos. Did you get any feedback on this from the developers?

Temu New user DIscount code Using Temu's DIscount […]

By using the Temu coupon code [acu600079], you can[…]

Yes, the Temu Coupon Code "aci384098" or[…]

Yes, the Temu Coupon Code "aci384098" do[…]