0

Hello I am working on a process maker 3.0 where i have 2 task.I want to display field value from task 1 into grid which is there in task2 how do i auto populate the grid in Processmaker here is i tried to write some trigger on task 2.

 getGridField("clientGrid", 1, "txtData").value = "0";
echo 'dddddddd';

where is clientGrid is the id of the grid and txtData is name of a text field inside the grid.

Rocking Birds
  • 165
  • 1
  • 17

3 Answers3

1

If you are just displaying the grid, I can recommend this:
1. create a Grid type Variable in the Process Variables.
2. associate the grid on task 1 to that variable
3. associate the grid on task 2 to the same variable - it will need to have the controls named the same as the grid in task 1 to display the values.

David Soo
  • 23
  • 4
1

I think this information can be important for you for populating grids

https://wiki.processmaker.com/3.0/Grid_Control#PHP_in_Grids

At his link, you will find how a grid behaves in structure. It is an associative array with many associative arrays.

0

If you try Javascript on 3.0, I would suggest you use the Jquery build in function: Refer here for grids and here for getting the value of the field

You can also use trigger to do it but it must be set on the 2nd Form, Before Dynaform.

You can refer to this code: (You have Item, Amount and Vendor as a ordinary field in the 1st Dynaform and wants it to be in the grid in the second)

$item = @@item;
$amount = @@amount;
$vendor = @@vendor;

@=grid_item = array(
     1 => array('item'=>$item,  'amount'=>$amount, 'vendor' => $vendor)
); 

For Javascript:

var item= $("#item").getValue();
var amount= $("#amount").getValue();
var vendor = $("#amount").getValue();

//inserting value in the grid 
//jQuery("#grid").setValue(value, row, col); syntax
jQuery("#grid_item").setValue(item, '1', '1');
jQuery("#grid_item").setValue(amount, '1', '2');
jQuery("#grid_item").setValue(vendor, '1', '3');

To make it more efficient in the JS process, use loop and all my codes are subject for debugging as I just create my code base on the wiki.

MiksMeister
  • 418
  • 2
  • 8
  • 20