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

Moderator: ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By Anuradha
Hello all,
We are creating process where data has to save in custom tables.So how can we get last inserted id of 1st insert query ,and insert it in 2nd insert query in 2nd table. How it is possible using executeQuery() of processmake. Can we use mysqli_connect(), mysqli_query() and mysqli_insert_id() in trigger.
User avatar
By amosbatto
If your tables are PM tables then use executeQuery(). See examples in the wiki. If tables are in an external database, then Create a database connection to the database holding the table. Then add a trigger which calls executeQuery() and use the ID of the database connection as the second parameter in the function.
By chieunh
you can use mysqli_connect(), mysqli_query() and mysqli_insert_id() in trigger.
// Check connection
if (mysqli_connect_errno())
die("Failed to connect to MySQL: " . mysqli_connect_error());
$sqlQuery = "......";
if(!mysqli_query($con,$sqlQuery )){
die("Error xxx");

$appNumber = @@APP_NUMBER;

In your custom tables, you should use appID or appNumber is primary key.
User avatar
By mk8800
it's too late and it's a ugly way but this is my way:
Code: Select all
$insertCount= executeQuery("INSERT INTO mytable (column) values('value')");
$result = executeQuery("select LAST_INSERT_ID() L");
And Closa Please improve data model and add features like this, you are so far behind from common php frameworks.

Hello ProcessMakers! We are extremely proud to an[…]

How processmaker load cases on home page of user? […]

Hey everyone, I'd appreciate any help you might be[…]

Error dynaform xml pm3

Thanks for sharing .