Skip to content

datasource.insert deprecated ​

Runs an INSERT statement against a datasource and returns the new row's key.

js
datasource.insert(datasource, query, parameters)

Parameters ​

ParameterTypeDescription
datasourcestringThe datasource's name. It must be a JDBC datasource.
querystringThe INSERT statement. Use ? placeholders for values.
parametersstring[]Values for the ? placeholders, in order.

Returns ​

number

The key generated for the new row, or 0 when there isn't one.

Examples ​

js
const id = datasource.insert("Internal Datastore", "INSERT INTO department_codes (department_id, department_name) VALUES (?, ?);", ["001", "Head Office"]);