Forum

Chris Bouveret
Keymaster
    Has successfully completed the online course Introduction
    Has successfully completed the online course Intermediate (200)
    Has successfully completed the online course Advanced (300)
    Has successfully completed the online course Basics (100)
    Has successfully completed the online course Advanced (320)
    Has successfully completed the Intermediate Certification
    Has successfully completed the Advanced Certification
6 years, 6 months ago #15510
Up
1
Down
::

The best way would be to create a business object and a method for your insert. You can then go ahead and call your SQL Connector. Just du something like that in your method:

try{
var connectorCallInsert = Simplifier.Connector.MySQLConnector.MySQLcall({"mode": "execute","request" : "Your Insert query"});
var connectorCallLastId = Simplifier.Connector.MySQLConnector.MySQLcall({"mode": "query","request" : "SELECT LAST_INSERT_ID();"});
output.lastId = connectorCallLastId;
output.success = true;
} catch (e) {
    output.message = e.message;
    output.success = false;
}

Make sure to add the output parameters “lastId”,”success” and “message” in your Business Object Method
The above BusinessObject executes your insert first and then gets the last Id inserted as output

Hope that helps