Skip to content

datasource.insert

Executes SQL against a datasource

This function is used to execute a SQL statement against a registered JDBC datasource.

js
datasource.insert(datastoreName, query, [...values]])

Parameters

  • datastoreName - The name of a registered datasource.
  • query - INSERT or CREATE SQL statement.
  • arguments - A list of parameterized values to insert in place of question marks in the sql statement.

Example

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