Skip to main content

Propels JavaScript reference

You can write custom logic in JavaScript to use in Propels. This page explains the Propels script structure and provides usage examples.

Script structure

The basic script structure is as follows:

someGlobalVar = "hello ";

function handleNode(context) {
msg = context.getParam("msg");

// levelops.serviceXYZ().doSomething() - Invoke an SEI service

return {
state: "success",
output: {
echo: someGlobalVar + msg

The script structure comprises the following components:

  • handleNode: This function is the entry point to the script.
  • context: An object with methods to look-up input variables.
  • return: The value is an object containing output data according to the output schema.
  • levelops: An object used to invoke SEI services.

Context methods

  • context.getParam(name, [defaultValue=null])
    • Use this method to access the node input parameters.
    • If not found, returns null.
    • Not typed.
  • context.getData(name, [defaultValue=null])
    • Access intermediate node data.
    • Useful for long-running tasks where the node wakes up multiple times.
    • If not found, returns null.

Output schema

The value of return is an object containing output data. The output schema is as follows:

state: "success" | "running" | "failure", // required
output: { "k1" : "v" , "k2" : ["v1", "v2"], "k3" : {}} // optional, map of output variables
data: {} // optional, node's internal data

SEI services

Use the levelops object to invoke SEI services.


Invoke CI/CD services with levelops.cicd().


  • Schema: getStageIds(jobRunId) : String[]
  • Description: List stages of a given CI/CD job run, if any.
  • Output: Returns an array of stage IDs. The array is empty if the job doesn't have stages.
  • Usage example: stageIds = levelops.cicd().listStageIds(jobRunId);


  • Schema: getStageName(stageId) : String
  • Description: Look up the name of a stage given its ID.
  • Output: Returns the stage name, or null if it wasn't found.
  • Usage example: stageName = levelops.cicd().getStageName(stageId);


  • Schema: hierarchicalConfigTableLookUp(jobRunId, stageId, tableName, jobColumnName, stageColumnName) : Object

  • Description: Look up a config table row.

  • Parameters: stageId and stageColumnName can be null.

  • Output: Returns a JSON object representing a table row (a map of column keys to values).

  • Usage examples:

    levelops.cicd().hierarchicalConfigTableLookUp(jobRunId, stageId, "My Config Table", "Job", "Stage");
    levelops.cicd().hierarchicalConfigTableLookUp(jobRunId, null, "My Config Table", "Job", "Stage");
    levelops.cicd().hierarchicalConfigTableLookUp(jobRunId, null, "My Config Table", "Job", null);


Invoke email services with levelops.emails().

send (one recipient)

  • Schema: send(subject, text, email)
  • Description: Send an email with a given subject, body (text), and recipient email address.
  • Usage example: levelops.emails().send("subject", "text", "");

send (multiple recipients)

  • Schema: send(subject, text, emails[])
  • Description: Send emails with the given subject and body (text) to multiple recipients.
  • Parameters: Specify recipients as an array of double-quoted, comma-separated email addresses.
  • Usage example: levelops.emails().send("subject", "text", ["email1@...", "email2@..."]);


Invoke Slack services with levelops.slack().

sendNotification (one recipient)

  • Schema: sendNotification(text, recipient)
  • Description: Send a notification with the supplied text to the specified recipient.
  • Usage example: levelops.slack().sendNotification("Hello World", "");

sendNotification (multiple recipients, send to channels, author by bot)

  • Schema: sendNotification(text, recipients[], botName)

  • Description: Send a notification with the supplied text to multiple recipients and channels. You can use a bot as the sender.

  • Parameters: Specify recipients and channels as an array of double-quoted, comma-separated email addresses and channel names. Supply the bot name after and outside the recipients array.

  • Usage examples:

    levelops.slack().sendNotification("Hello World", ["", "channel"]);
    levelops.slack().sendNotification("Hello World", [""], "AcmeBot");


Invoke SEI tables services with levelops.tables().


  • Schema: query(tableName, [ filters, [ filteringMode ] ]) : Object[]

  • Description: Use the supplied filters to search the specified table.

  • Parameters: filteringMode can be exact_match(default), contains, or starts_with.

  • Output: Returns an array of JSON objects representing table rows (a map of column keys to values).

  • Usage examples:

    levelops.tables().query("TableName", { "ColumnName": "search string" }, "contains");
    levelops.tables().query("Users", { "Last Name": "Avery" }, "contains");


  • Schema: distinct(tableName, columnName, [ filters, [ filteringMode, [ splitCommaLists ] ] ]]) : String[]

  • Description: Pull values from the specified column in the specified table. Filters are optional; exclude filters to return all values in the column.

  • Output: Returns an array of distinct values from the column provided. If filters were specified, the values are limited to rows matching the filters.

  • Usage examples:

    levelops.tables().distinct("Table Name", "Column Name");
    levelops.tables().distinct("Users", "Last Name");


  • Schema: getColumnNameToKeyMappings(tableName) : Object
  • Description: For the specified table, get a mapping of column names and keys.
  • Output: Returns a map of column display names to column keys.
  • Usage example: levelops.tables().getColumnNameToKeyMappings(Users);


  • Schema: updateColumn(tableName, columnName, rowId, value)
  • Description: Replace a value in the specified cell (columnName and rowId) of the specified table.
  • Usage examples:
levelops.tables().updateColumn("Table", "Column 1", row["id"], "new value");
levelops.tables().updateColumn("Users", "Last Name", row["7"], "Quinn");


Invoke SEI tickets services with


  • Schema: create(title, [ reason ], userEmails[]) : String

  • Description: Create an SEI ticket.

  • Output: Returns the ID of the created ticket.

  • Usage examples:

    ticketId ="Ticket Title", [""]);
    ticketId ="Ticket Title", "Reason", []);


Invoke assessments services with levelops.assessments().


  • Schema: send(ticketId, assessmentTemplateName, [senderEmail]) : String
  • Description: Send an assessment to a ticket's assignees.
  • Output: Returns the ID of the assessment that was sent.
  • Usage example: assessmentId = levelops.assessments().send(ticketId, "Assessment Template Name", "");