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({})

Type parameters

  • Context: ProcessContext

Hierarchy

Properties

__name

__name: TString

Name of the process.

code

code: TString

Code of the process template.

Readonly context

context: Context

Description of the process context.

namespace

namespace: TString

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

  • run(context: Context): Promise<TString>
  • 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

      Initial process context.

    Returns Promise<TString>

    ID of a launched process.