Skip to content

datasource.update

Executes SQL against a datasource

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

js
datasource.update(datastoreName, query);

Parameters

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

Example

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

The function will return a boolean true or false depending on if the statement executed without issue.