Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By heemalkumar
#815324
Hi Guys
I have been approached by a team to set-up an interesting model.

This model is called a pricing model. The way this model works is, a Manager initiates a case and send to a Senior Manager for approval.
Once Senior Manager approves case, this case should go to 5 Members for supporting the pricing change. Out of this 5 Members, if 3 Members support the case, the case is regarded as approved and should inform the Initiating Manager that the Pricing is now approved.

How do I go about with this?
User avatar
By amosbatto
#815328
Create 5 parallel tasks in your process:
ParallelMultipleApprovalProcess.png
ParallelMultipleApprovalProcess.png (22.5 KiB) Viewed 4658 times
Each parallel task has a different dynaform which has a dropdown with the options "approved" or "rejected" and it is associated with the variables priceChange1, priceChange2, priceChange3, priceChange4, priceChange5, respectively.

In the first task (before the parallel tasks), set the following trigger to fire before assignment:
Code: Select all
@%approvedChangeCount = 0;
Then in the first parallel task, set the following trigger to fire before assignment:
Code: Select all
if (@@priceChange1 == 'approved') {
   @%approvedChangeCount++;
}
Then in the second parallel task, set the following trigger to fire before assignment:
Code: Select all
if (@@priceChange2 == 'approved') {
   @%approvedChangeCount++;
}
Do the same for the rest the parallel tasks, using a different trigger with @@priceChange3, @@priceChange4 and @@priceChange5.

Then in a exclusive gateway following the parallel tasks, use the following conditions:
End process: @%approvedChangeCount < 3
Go to next task: @%approvedChangeCount >= 3
By heemalkumar
#815350
Hi Amos
I am struggling with the Approved/Declined notification.

So I am testing this out.
I have added 5 people in as 5 approvers.

When 2 have approved, it fires a declined notification out, however, this shouldn't happen as the other 3 haven't approved or declined.

When 3 approve, and 2 decline, it should only fire an Approved notification. At the moment it seems to fire both Approved and Decline notification.

Can someone help me correct my logic pls.
Attachments
(459.12 KiB) Downloaded 211 times
User avatar
By amosbatto
#815352
Create a script task before the exclusive gateway with this code:
Code: Select all
if (@%approvedChangeCount >= 3) {
   PMFSendMessage(@@APPLICATION, $from, $to, '', '', 'Price change accepted', 'priceChangeAccepted.html');
}
else {
   PMFSendMessage(@@APPLICATION, $from, $to, '', '', 'Price change denied', 'priceChangeDenied.html');
}
By heemalkumar
#815360
Thanks AMos

Finally got the model to work.

However, I noticed that all 5 have to either approve or decline inorder for the script to work?

Is there a way that as soon as 3 approve, script runs and sends an email, or when 3 decline, script runs and sends an email?
Attachments
(474.66 KiB) Downloaded 230 times
By heemalkumar
#815616
Hi Guys
The below is my Script task. Im trying to get @#customer to show in my Subject field. Currently the subject just shows as
Price change accepted - $sub

It doesn't pick up the field @#customer. How do i fix this?
Code: Select all
if (@@areaManagerDecision == 1) {
   $to = @@email; 
   $sub = @#customer;
   PMFSendMessage(@@APPLICATION, 'Price Change', $to, 'sbibi@westpac.com.au, hkumar@westpac.com.au', '', 
       'Price change accepted - $sub', 'approvedwithinlimit.html');
}
User avatar
By amosbatto
#815620
You are converting your "customer" case variable into a floating point number by accessing it as @#customer in a trigger. Is that what you want? In PHP, you can't insert variables inside a single quoted string. You need to use a double quoted string.

Try it this way:
Code: Select all
if (@@areaManagerDecision == 1) {
   $to = @@email; 
   $sub = @@customer;
   PMFSendMessage(@@APPLICATION, 'Price Change', $to, 'sbibi@westpac.com.au, hkumar@westpac.com.au', '', 
       "Price change accepted - $sub", 'approvedwithinlimit.html');
}
By heemalkumar
#816076
Hi Team
Attached is my Pricing Model screenshot.

What the below does, all 5 LTAC members approve/decline the pricing request. According to the count, whichever is 3, it sends an email as approved or declined to initiator.

What I would want is, once 3 members approve request/decline request, i would like an email to fire and send to initiator.
A further email can be sent again once all 5 members approve/decline.

How do i do this?
Attachments
Add description
(592.15 KiB) Downloaded 244 times
Add description
(108.36 KiB) Downloaded 222 times
User avatar
By amosbatto
#816127
First of all, the second parameter in PMFSendMessage() needs to be the email which you configured under Admin > Settings > Email Servers, this code won't work:
Code: Select all
   PMFSendMessage(@@APPLICATION, 'Price Change', $to, 'sbibi@westpac.com.au, hkumar@westpac.com.au', '', 
       "Price change accepted - $sub", 'approvedwithinlimit.html');
It needs to be something like:
Code: Select all
   PMFSendMessage(@@APPLICATION, 'myadmin@example.com', $to, 'sbibi@westpac.com.au, hkumar@westpac.com.au', '', 
       "Price change accepted - $sub", 'approvedwithinlimit.html');
To send out an email to the user who started the case, use code like this:
Code: Select all
if (@%approvedChangeCount >= 3) {
    $c = $new Cases();
    $aCaseInfo = $c->LoadCase(@@APPLICATION);
    $caseStarterId = $c->$aCaseInfo["APP_INIT_USER"];
    $caseStarterEmail = userInfo($caseStarterId)['mail'];
    PMFSendMessage(@@APPLICATION, "myadmin@example.com", caseStarterEmail, '', '', 'My message title', 'myTemplate.html');

    //add code here to route on all the other parallel tasks
}
See: https://wiki.processmaker.com/3.0/Inter ... Case.28.29

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]

A Bet365 Clone Script is essentially a ready-made […]