Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By amform
#785189
Hi,
I have a question I have been using ProcessMaker for a little more than a month, and I already know how to send an automatic email(PMFSendMessage()).However, I would like to know if it is possible to create a button that after been clicked send and email or to create a trigger where a new email can be create it (Outlook).
Thanks for the help.
Regards.
By amform
#785222
Hi Ethan,
Thanks for your reply.
I created a trigger before task to retrieve the trigger ID from the PM database, but it didn't work. This is my Query:

$trigger_id = '';

$qry = 'SELECT UID FROM wf_{workflow}.TRIGGERS.TRI_UID';
$result = executeQuery($qry);
if(is_array($result) && count($result) > 0) {
foreach($result as $re) {
$trigger_id = $re['UID'];
}
}
@@Trigger_ID = $trigger_id;

If I'm not taking the right approach let me know.
Also, can you give me and example of a JS code where using the .onclick I can call the trigger to be execute?
Thanks for your help.
User avatar
By amosbatto
#785260
You can use REST to execute a trigger with JavaScript code, but it is much easier to just use a submit button to do it.

First of all, see this example to understand the concept of tying trigger code to a submit button:
http://wiki.processmaker.com/3.0/Submit ... ancel_Case

You need to add an additional submit button to your DynaForm whose ID and name is "sendEmail". Add JavaScript to your DynaForm to add a value to the button when clicked:
Code: Select all
$("#form\\[sendEmail\\]").click(function(){
  this.value = "SEND";
});


Then add the following trigger which is executed after the DynaForm, which will send out the email, if the "sendEmail" button was clicked:
Code: Select all
if (@@sendEmail == "SEND") {
   PMFSendMessage(...);
}
By amform
#785401
thanks amosbatto.
At the end this is what I did following what you gave me:
JS code:
document.getElementById("form[btn_email]").onclick = function() {
getField("send_email_2").value = "send";
}
PHP condition:
@@send_email_2 == "send"
and PMFSendMessage...
Doing it this way the email is sent after I submitted the task.
By petergroft
#830130
The users need to have an email app installed on their computers.
Insert a Button Element.
Create a Title for the Button. Design the SharePoint site your team deserves. ...
Fill in the Link Field. Please type in the command mailto: and the desired email of the addressee. ...
Save the page and enjoy the result!

Greetings,
Peter
Most Demanding OST to PST Converter

thanks for sharing this info......................

What drew me to SmokAce Casino https://smokace.cas[…]

Best tool to Convert PST to HTML File

When it comes to converting PST files to HTML form[…]

Master the Apple Certified Support Professional ([…]