Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
User avatar
By amosbatto
#789496
What you have to do is create a trigger in one of your processes, with code like this:
Code: Select all
$db = 'XXXXXXXXXXXXXXXXXXXXXX'; //set to ID of your database connection to a MSSQL database
//assign to a normal PHP variable to insert in the query
$fieldB = @@fieldB; 
//remove single quotation marks around '$fieldB' if FIELDB is a number field
$sql = "SELECT FIELDX, FIELDY, FIELDZ FROM TABLEA WHERE FIELDB='$fieldB' ORDER BY FIELDX";
@=dbResult = executeQuery($sql, $db);
(Note: This trigger doesn't need to be set to fire in a step in the process.)

In your web services script, call the sendVariables() web service to set the value of fieldB. Then, call executeTrigger() to fire the trigger. Then, call getVariables() to get the value of dbResult, which should have a format like this:
Code: Select all
array(
   '1' => array( 'FIELDX' => 'valuex', 'FIELDY' => 'valuey', 'FIELDZ' => 'valuez'),
   '2' => array( 'FIELDX' => 'valuex', 'FIELDY' => 'valuey', 'FIELDZ' => 'valuez'),
   '3' => array( 'FIELDX' => 'valuex', 'FIELDY' => 'valuey', 'FIELDZ' => 'valuez')
)

Everybody wants to be famous, but nobody wants to […]

Hi, I attached a sample config file, Please check […]

Error clicking on Participated

Hi, I attached a sample config file, Please check […]

Hello, Is it possible to set variables in a defau[…]