Questions and discussion about using ProcessMaker: user interface, running cases & functionality
By karl009
#791708
Hello,

Am looking to use Web Entry but I would like the user assignment to be based on a drop-down box so far I have been unsuccessful in doing this, I use a trigger and have assigned into the form

Here is the trigger I used;

if (@@L1_Zone == "RED")
{
@@ZLeader = '492645263a1086307799';
}
else if (@@L1_Zone == "BLUE")
{
@@ZLeader = '697143554c2b24090073882';
}

Under steps I have set the trigger to after dynaform, and under assignment rules I have set Value Based Assignment with @@ZLeader as the variable, but when submitting the web form I get the following message

Task doesn't have a valid user in variable ZLeader or this variable doesn't exist.

Can anyone help.
Thanks
Karl
#791710
There is no way to set triggers to fire before or after the DynaForm used by Web Entry. There is an option to set a trigger to fire when a case is created in PM 3.2 and later. That trigger can set the variable which is used by Value Based Assignment in the process's first task, but that trigger doesn't have access to the DynaForm's submitted data when it is fired.

Instead of using a trigger to set the next user, it is recommended to add a hidden field to the DynaForm which is associated with the variable used by Value Based Assignment in the process's first task. Then, add JavaScript to set the value of that hidden field when the DynaForm is submitted.

For example, the following process uses Web Entry to submit an application form which starts the case:
AssignmentRulesFirstTask.png
AssignmentRulesFirstTask.png (44.83 KiB) Viewed 3822 times


The first task named "Process Application" uses Value Based Assignment and its variable is @@nextUser. It has two users in its assignment pool.
WebEntryProcess.png
WebEntryProcess.png (7.32 KiB) Viewed 3822 times
This process uses the following DynaForm in its Web Entry to start cases.
WebEntryForm.png
WebEntryForm.png (46.73 KiB) Viewed 3822 times
The "selectCourse" dropdown has the following list of options:
WebEntryCourseList.png
WebEntryCourseList.png (11.66 KiB) Viewed 3822 times
If the user selects the "Automotive design" option in the "selectCourse" dropdown, then the new case should be assigned to the "admin" user whose ID is "00000000000000000000000000000001". If any other course is selected, then the new case should be assigned to another user with the ID "143946999592369b2e90cd5080999198".

The following JavaScript code is added to the DynaForm to set the value of a hidden field which is associated with the "nextValue" variable, when the DynaForm is submitted:
Code: Select all
var oForm = getFormById( $("form").prop('id') );
oForm.setOnSubmit( function(){
  if ($("#selectCourse").getValue() == 'F101') {
    $('#nextUser').setValue('00000000000000000000000000000001');
  }
  else {
    $('#nextUser').setValue('143946999592369b2e90cd5080999198');
  }
});
To test out setting the next user during web entry, download this sample process:
(40.66 KiB) Downloaded 290 times
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]