Start a conversation

Selecting records from a Grid using the Run button

This new option in the Grid allows to create a button to process PHP code on records selected (checkbox).

Creating a New Button

1- Creating a new button "Run" in the Grid to access the various lines of the field application.

2- Inform the button name: "Process”.

3- This button type has 2 events for processing codes PHP.

onRecord: runs through each record that was selected.
onFinish: process executed after all the records selected

4- To do our request, first, let's create some global variables in Event onApplicationInit

Evento: OnInit
[i] = 0;
It will be our matrix key
[total_chked] = array();
Array where we keep all the selected values

5- Now we can user [i] and [total_chked] in the onRecord and onFinish of Run Button.

Event in the Button: onRecord.


Event in the Button: onRecord.
$arr=[i]; Keeping the index to a local variable 
Assign the name of the contact with the matrix 
[i]++; increment the key the acess the position array next 

Event of button: onFinish


Event of button: onFinish
$tot = count([total_chked]); counting the total number of records checked
$contacts = $tot." Selected Contacts: "; Will keep the message to be displayed
    $contacts .= [total_chked][$x];

if($x == ($tot-1)){

$contacts .= ".";


$contacts .= ", ";


This code will check who is the last value
selected to add a dot or a comma
echo "(".$tot.") Selected Contacts:  ".$contacts; show message with all selected contacts

6- Go in "Application->Global Variable" to set the [i] and [total_chked] to be "out"


7. after running application, select the records and click in the "Process" button.


After clicking the Process button:


Choose files or drag and drop files
Was this article helpful?
  1. Caio Guerra (Migrated deleted Agent)

  2. Posted
  3. Updated