Type parameters
-
Context: ProcessContext
Hierarchy
-
ProcessTemplate<Context>
- Process
Properties
__name
Name of the process.
code
Code of the process template.
Readonly context
Description of the process context.
namespace
Workspace of the process template.
Methods
_searchInstances
-
The method is used to search for process instances.
Example:
const instances = await Global.processes.my_process_1._searchInstances().all();
Returns ProcessInstanceSearch
Search object for processes.
_searchTasks
-
The method searches for process tasks based on specified conditions.
Example:
const tasks = await Global.processes.my_process_1._searchTasks().all();
Returns ProcessInstanceTaskSearch
Search object for tasks.
run
-
The method launches the execution of a process.
When you start a process, you need to set the context data. Process context stores the data that a process works with while it is executed. Example:
async function runProcess(): Promise<void> { // Writing the `my_process` business process to the `processTemplate` variable // to be able to start it later const processTemplate = Global.processes. my_process; // Getting a document’s number from the context const documentNumber = Context.data.documentNumber; // Getting the author’s name from the context const authorName = Context.data.authorName; // Loading data using a function const bytesContent = await downloadDocumentFile(); // Creating a temporary file in the system to add it to the process’s context const temprorayFile = await System.files .createTemporary('file.docx', bytesContent); // Starting the process using its input data as the argument // The data is defined by the context of the process // Data transmission format is an object that has field codes //as keys await processTemplate.run({ authorName: authorName, documentContent: temprorayFile, documentNumber: documentNumber, }); }
Parameters
-
context: Context
Returns Promise<TString>
ID of a launched process.
-
Process object
This object is used to start processes and search for process instances or process tasks. The Process.run method starts a process. [[Process. _searchInstances]] searches for process instances. Process._searchTasks searches for process tasks. Example of starting a process:
await Global.ns._clients.app._leads.processes._call.run({})