Share ideas, ask questions, and get feedback about developing for ProcessMaker
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')
)

Nice post and please provide more information. Tha[…]

The step by step guide to convert MBOX files to P[…]

Starting a business in a white-label NFT marketpla[…]

Well if you are a startup who has a dream to build[…]