Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#787394
Hello,

Since a few weeks now i'm trying to train myself on ProcessMaker.

Now I have designed a process I need to build. This is a process to automate the add of a server in our monitoring system.

* In the process the user must be able to fill a form (Choose a service to monitor), then choose if he want to add another one, or if it's over.
* If he want to add another one service, he must fill form (Choose a service to monitor) again, and he must be able to do this as many times as he want to.

* When he has finished, we show him a Summary of all the services he has choosed and their parameters.
* And he can choose to start over by reseting to 0 the service list or to validate the list and start a script who will put all this information into a message queueing system (or other, this part is not decided)

I'm still learning and i'm not sure that ProcessMaker is the right tool for this.

So i have several questions :

- How can i do this loop ? Do i must store the temporary data into a database ? There is another way ?

- When running a case, how can i chain several Task without the need to see after each submit the case to be assign to someone ?
Because actually between 2 Task/Dynaforms (like "Choose she server and IP from CMDB" and "Choose a service to monitor"), the case is assigned to the admin (so the page close), and i need to re-open the case to see the next form.
All the step from my workflow are done by the same person, i just need to show page, fill them, and use gateway to follow the right path.

My process to show my idea/need is attached

Thanks.
Attachments
(75.17 KiB) Downloaded 284 times
#787415
You can store the list of services in a grid, which has a row for each service. For example, if the grid is associated a grid variable named "servicesGrid", then after each loop, add the variables entered into the form into the grid in a trigger like this:
Code: Select all
if (!isset(@=servicesGrid)) {
  @=servicesGrid = array();
}
$nextRowNo = count(@=servicesGrid) + 1;
@=servicesGrid[ $nextRowNo ] = array(
    "var1" = @=var1,
    "var2" = @=var2,
    "var3" = @=var3
);
Where var1, var2 and var3 are the names of the variables which were filled in the dynaform.

Then, display that grid to the user at the end to approve or restart. Make sure that the fields inside the grid have the IDs of "var1", "var2", and "var3" so the values will be displayed in the grid. If the user choses to restart, then you can clear the grid with this code:
Code: Select all
unset(@=servicesGrid);


You don't need to use multiple tasks in your process. You can create all the DynaForms in the same task. Then add triggers between the DynaForms to to either return to the DynaForm to fill out a service or go to the final DynaForm to approve all the services in the list. Use PMFRedirectToStep() to go to a DynaForm inside the Task or PMFDerivateCase() to end the task. To understand how to redirect with buttons in a DynaForm, see:
http://wiki.processmaker.com/3.0/Submit ... n_triggers
#794124
Essentially I wish to do the above, have a grid on a dynaform and use another dynaform to populate it. The reason being is that there are so many fields, a grid is not an easy control to use on the client end, so a full scrollable page is much easier on the eyes and brain.

The dynaform dumps its data into the grid, for which I can keep all fields hidden except the first, so the user sees what they have added and what they have not. Corresponding field ID's are the same in both the grid and dynaform.

I haven't been able to dump the data into the grid, and also I need to clear the dynaform on the next request. I keep getting the same values in a form that I want to be blank each time.

Any examples would help. :)
#794578
Your trigger code should be something like this:
Code: Select all
if (!isset(@=gridPets)) {
   @=gridPets = array();
}

$nextRowNo = count(@=gridPets) + 1;
@=gridPets[$nextRowNo] = array(
   "pets_name"         => @@pets_name,
   "pets_name_label"   => @@pets_name_label,
   "pets_species"      => @@pets_species,
   "pets_species_label"=> @@pets_species_label
);
unset(@@pets_name);
unset(@@pets_name_label);
unset(@@pets_species);
unset(@@pets_species_label);
You can place both forms in the same task, and then use PMFRedirectToStep() to return the form to add another pet if the user chooses the option to add another pet. See this example of how to use the function:
http://wiki.processmaker.com/3.0/Submit ... n_triggers
#794727
Your code has many problems. First of all, you are trying to call PMFRedirectToStep() in JavaScript, but it is a PHP function. You mixed together PHP and JavaScript examples. Second, your Trigger code didn't work because your variables were @@pets_name, when they should have been @@pet_name. Third, you are using general buttons in your DynaForm, when you should have been using submit buttons, so your DynaForms were never submitting the data and never advancing.

I have fixed your code to work and added a condition to the "Add Pet" form, so it only displays if the user clicks on the "Add a Pet" button in the first form. See the attached process.
(37.95 KiB) Downloaded 294 times

To convert MBOX to PST, start by downloading and i[…]

My Assignment Services stands out as one of the be[…]

Erectile Dysfunction, commonly known as impotence,[…]

Want to create your own meme coin?

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