ProcessService
import { ProcessService } from "@skipcheck/tm1-client";Used in the walkthrough Run a process and read its result.
Processes (TurboIntegrator): /Processes, compiling and running them, and their
error logs.
Parameters go as a map of name to value, in order; a numeric parameter needs a number, not text. Running a process returns when it ends, however long that takes: give the request a timeout that fits, and know that cancelling the call doesn't stop the process on the server.
Create a process, compiling it first, since TM1 saves code that doesn't compile:
// TM1 saves code that doesn't compile, so compile the definition first
const process = ProcessPatch.builder()
.name("Load Sales")
.parameters([
ProcessParameterPatch.builder().name("pVersion").value("Actual").type(ProcessVariableType.String).build(),
ProcessParameterPatch.builder().name("pYear").value(2026).type(ProcessVariableType.Numeric).build(),
])
.prologProcedure("LogOutput('INFO', 'Loading ' | pVersion | ' for ' | NumberToString(pYear));\n")
.build();
const errors = await tm1.processes.compile(process).toArray();
if (errors.length > 0) throw new Error("The process doesn't compile: " + JSON.stringify(errors));
return tm1.processes.create(process);
Run it with parameters, and fail if it wrote an error log:
// Parameters by name, in order; a numeric one takes a number, not text
const parameters = { pVersion: "Forecast", pYear: 2026 };
const withLog = ODataQuery.none().expand(ProcessExecuteResult.Fields.ErrorLogFile);
const result = await tm1.processes.executeWithReturn("Load Sales", parameters, withLog);
// A run that ended with errors names the log it wrote
if (result.ErrorLogFile) throw new Error(`${result.ProcessExecuteStatusCode}: see ${result.ErrorLogFile.Filename}`);
return result;
Run code without saving it as a process:
// A one-off run of code that isn't saved as a process
const cleanup = ProcessPatch.builder().name("Clear Sales Staging").prologProcedure("CubeClearData('Sales Staging');\n").build();
return tm1.processes.executeWithReturn(cleanup);
Members
list | GET Processes, streamed. |
get | The process, or a Tm1NotFoundException if there's none. |
create | Creates a process (it needs a name); returns it as created. |
update | Changes the properties the patch sets, such as a procedure. |
delete | DELETE Processes('name'). |
compile | Compiles a saved process. |
compile | Compiles a process definition that needn't be saved, such as one about to be created. |
compile | |
executeWithReturn | Runs a process and says how it ended (ProcessExecuteStatusCode, and the error log's file if it wrote one). |
executeWithReturn | Runs a process definition that needn't be saved. |
executeWithReturn | |
execute | Runs a process, without saying how it ended. |
execute | Runs a process definition, without saying how it ended. |
execute | |
errorLogs | GET Processes('name')/ErrorLogs, streamed. |
errorLogContent | An error log's text. |
list
list(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Process>GET Processes, streamed.
TM1 REST EntitySet Processes
get
get(name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Process>GET Processes('name'): the process, or a Tm1NotFoundException if there's none. TM1 (11.8) leaves most of DataSource, and UIData and VariablesUIData, out of a $select=*: select them by name, or select nothing, to get them.
TM1 REST EntitySet Processes
create
create(process: ProcessPatch, options?: Tm1CallOptions): Promise<Process>POST Processes: creates a process (it needs a name); returns it as created. TM1 (11.8) saves code that doesn't compile: check it with compile first.
TM1 REST EntitySet Processes
update
update(name: string, patch: ProcessPatch, etag?: string | null, options?: Tm1CallOptions): Promise<void>PATCH Processes('name'): changes the properties the patch sets, such as a procedure. With etag (process["@odata.etag"]), sent as If-Match: only if the process hasn't changed since, else a Tm1PreconditionFailedException. TM1 (11.8) saves code that doesn't compile.
TM1 REST EntitySet Processes
delete
delete(name: string, options?: Tm1CallOptions): Promise<void>DELETE Processes('name').
TM1 REST EntitySet Processes
compile
compile(name: string, options?: Tm1CallOptions): Tm1Stream<ProcessSyntaxError>tm1.Compile: compiles a saved process. Needs schema 11.0.0. The syntax errors, by procedure and line; none if it compiles.
TM1 REST Action Process/Compile ActionImport CompileProcess
compile
compile(definition: ProcessPatch, options?: Tm1CallOptions): Tm1Stream<ProcessSyntaxError>CompileProcess: compiles a process definition that needn't be saved, such as one about to be created. Needs schema 11.0.0.
TM1 REST Action Process/Compile ActionImport CompileProcess
compile
compile(nameOrDefinition: string | ProcessPatch, options?: Tm1CallOptions): Tm1Stream<ProcessSyntaxError>TM1 REST Action Process/Compile ActionImport CompileProcess
executeWithReturn
executeWithReturn(name: string, parameters?: Tm1Map<unknown> | null, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessExecuteResult>tm1.ExecuteWithReturn: runs a process and says how it ended (ProcessExecuteStatusCode, and the error log's file if it wrote one). Needs schema 11.3.0. A ProcessError, or a runtime error, ends it Aborted, with an ErrorLogFile named tm1processerror_<time>_<process>.log (expand it with query). A run cancelled through its thread (ThreadService.cancel) fails instead, with a Tm1ServerException (TM1UserException: Cancel, code 174).
TM1 REST Action Process/ExecuteWithReturn ActionImport ExecuteProcessWithReturn Navigation ProcessExecuteResult/ErrorLogFile
executeWithReturn
executeWithReturn( definition: ProcessPatch, parameters?: Tm1Map<unknown> | null, query?: ODataQuery | null, options?: Tm1CallOptions, ): Promise<ProcessExecuteResult>ExecuteProcessWithReturn: runs a process definition that needn't be saved. Needs schema 11.3.0.
TM1 REST Action Process/ExecuteWithReturn ActionImport ExecuteProcessWithReturn Navigation ProcessExecuteResult/ErrorLogFile
executeWithReturn
executeWithReturn( nameOrDefinition: string | ProcessPatch, parameters?: Tm1Map<unknown> | null, query?: ODataQuery | null, options?: Tm1CallOptions, ): Promise<ProcessExecuteResult>TM1 REST Action Process/ExecuteWithReturn ActionImport ExecuteProcessWithReturn Navigation ProcessExecuteResult/ErrorLogFile
execute
execute(name: string, parameters?: Tm1Map<unknown> | null, options?: Tm1CallOptions): Promise<void>tm1.Execute: runs a process, without saying how it ended.
TM1 REST Action Process/Execute ActionImport ExecuteProcess
execute
execute(definition: ProcessPatch, parameters?: Tm1Map<unknown> | null, options?: Tm1CallOptions): Promise<void>ExecuteProcess: runs a process definition, without saying how it ended. Needs schema 11.0.0.
TM1 REST Action Process/Execute ActionImport ExecuteProcess
execute
execute(nameOrDefinition: string | ProcessPatch, parameters?: Tm1Map<unknown> | null, options?: Tm1CallOptions): Promise<void>TM1 REST Action Process/Execute ActionImport ExecuteProcess
errorLogs
errorLogs(name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ProcessErrorLog>GET Processes('name')/ErrorLogs, streamed: the logs its failed runs wrote, keyed by their timestamps.
TM1 REST Navigation Process/ErrorLogs
errorLogContent
errorLogContent(name: string, log: ProcessErrorLog, options?: Tm1CallOptions): Promise<string>GET Processes('name')/ErrorLogs('timestamp')/Content: an error log's text. TM1 keys error logs by their timestamp as a quoted string, written as the Java client writes it (OffsetDateTime's toString: 2026-01-02T03:04Z, 2026-01-02T03:04:05.120Z).
TM1 REST Navigation Process/ErrorLogs