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.
By tzewin
#780193
Dear all,

May I know how to set the recipient user? For example,

User A log in , after he/she finish the task. An email will sent out to the user B.

User A as a user_logged on
User B has a variable name as @@DriverName

May I know use what way?

I use PMFGetUserEmailAddress(), it didn't work anythings.

But the assigned rule, it can work

THanks
By tzewin
#780194
Code: Select all
$sRecipientTO  = userInfo(@@DriverName);




/*Composing the message using PMFgetUserEmailAddress() PM function*/
$from     = 'info@processmaker.com';
$to       = $sRecipientTO['mail'];
$subject  = 'Change Checklist';
$template = 'rejected.html';

/*send using PMFSendMessage() PM function*/
if(@@checklistDecision==N){
PMFSendMessage(@@APPLICATION, $from, $to, '','', $subject, $template);
}
This is my code.
User avatar
By liliana
#780199
Hi tzewin,

I think the solution is simple, you can save the User B email in a hidden field and pass that field thorough tasks until you are in the task where you need to use that variable. Your code should be something like:
Code: Select all
/*Composing the message using PMFgetUserEmailAddress() PM function*/
$from     = 'info@processmaker.com';
$to       =  @@DriverName;
$subject  = 'Change Checklist';
$template = 'rejected.html';

/*send using PMFSendMessage() PM function*/
if(@@checklistDecision==N){
PMFSendMessage(@@APPLICATION, $from, $to, '','', $subject, $template);
}


Hope this helps.

Regards,
By tzewin
#780203
liliana wrote:Hi tzewin,

I think the solution is simple, you can save the User B email in a hidden field and pass that field thorough tasks until you are in the task where you need to use that variable. Your code should be something like:
Code: Select all
/*Composing the message using PMFgetUserEmailAddress() PM function*/
$from     = 'info@processmaker.com';
$to       =  @@DriverName;
$subject  = 'Change Checklist';
$template = 'rejected.html';

/*send using PMFSendMessage() PM function*/
if(@@checklistDecision==N){
PMFSendMessage(@@APPLICATION, $from, $to, '','', $subject, $template);
}


Hope this helps.

Regards,

Hi Liliana,

I had try too. I use query to get the user B email in hidden field. But still fail. It seem that, it couldn't take the email.
By pereirablair
#780227
Hi tezwin,

why don't you try using the process maker feature of notification.You wont need to write a trigger for this.If your steps and conditions are only:(Once a task is completed,a mail should be sent out to the next user),Using this process maker feature,process maker will automatically send the mail to the users or group assigned.

check this:
http://wiki.processmaker.com/index.php/ ... ifications
this will surely help your need.

regards,
blair pereira
By tzewin
#780265
pereirablair wrote:Hi tezwin,

why don't you try using the process maker feature of notification.You wont need to write a trigger for this.If your steps and conditions are only:(Once a task is completed,a mail should be sent out to the next user),Using this process maker feature,process maker will automatically send the mail to the users or group assigned.

check this:
http://wiki.processmaker.com/index.php/ ... ifications
this will surely help your need.

regards,
blair pereira

Hi blair,

I understand that using notification can help me out , but I using the If condition to decide whether to send the email out.

Thanks
By pereirablair
#780284
Hi tezwin,

This is one of my working code.


$tkt=@@Ticket_Number;//Ticketnumber same as case number(gets the current case number)

//selecting a user from database,saved his name during transaction
$query="select Line_Manager from route_status where check_s =1 and Ticket_id=$tkt";
$result=executeQuery($query,'57373046853708febc4f157096042181');
$output=$result[1]['Line_Manager'];//outputs username in variable $output.

//selecting userid from database based on his username from $output
$query1="select USR_UID from users where USR_USERNAME='$output'";
$usrlogged=executeQuery($query1);
@@uid=$usrlogged[1]['USR_UID'];//saving userid on temporary variable using @@variablename


//instiantiating user details in processmaker function userInfo();
$usrF = userInfo(@@uid);//passing uid in userInfo();
$to = $usrF['mail'];//instiantiating to fetch mailid of user.


//if else condition wether to send mail or not.
if(@@USER_LOGGED==@@uid)
{
@@uStat='Line Manager same as Current User Void Notification ';
}
else
{

PMFSendMessage(@@APPLICATION,'ticketadmin@processmkaer.com',$to,'','','Ticket Acknowledgement','ACKNOWLEDGEMENT.html');//processmaker funtion to send mail

}

Hope this is useful to you.If not explain me what you are relly want to do step by step.

regards,
blair pereira
By tzewin
#780286
pereirablair wrote:Hi tezwin,

This is one of my working code.


$tkt=@@Ticket_Number;//Ticketnumber same as case number(gets the current case number)

//selecting a user from database,saved his name during transaction
$query="select Line_Manager from route_status where check_s =1 and Ticket_id=$tkt";
$result=executeQuery($query,'57373046853708febc4f157096042181');
$output=$result[1]['Line_Manager'];//outputs username in variable $output.

//selecting userid from database based on his username from $output
$query1="select USR_UID from users where USR_USERNAME='$output'";
$usrlogged=executeQuery($query1);
@@uid=$usrlogged[1]['USR_UID'];//saving userid on temporary variable using @@variablename


//instiantiating user details in processmaker function userInfo();
$usrF = userInfo(@@uid);//passing uid in userInfo();
$to = $usrF['mail'];//instiantiating to fetch mailid of user.


//if else condition wether to send mail or not.
if(@@USER_LOGGED==@@uid)
{
@@uStat='Line Manager same as Current User Void Notification ';
}
else
{

PMFSendMessage(@@APPLICATION,'ticketadmin@processmkaer.com',$to,'','','Ticket Acknowledgement','ACKNOWLEDGEMENT.html');//processmaker funtion to send mail

}

Hope this is useful to you.If not explain me what you are relly want to do step by step.

regards,
blair pereira
Hi blair,

Ok, I will try it out. Thanks

If you're looking to save big on your next online […]

If you're looking to save big on your next online […]

If you're looking to save big on your next online […]

Use the latest Freecash referral code "FC2507[…]