IBProcessStarterFactory.Single

Syntax

Single: IBProcessSingleStarter;

Description

The Single method returns the object used for starting one process instance.

Example

Executing the example requires that the repository contains a process with the PROCESS identifier. The process has no parameters.

Add links to the BPM, Metabase system assemblies. Add a link to the assembly that is required to work with processes.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Process: IBProcess;
    SingleStarter: IBProcessSingleStarter;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("PROCESS");
    Process := BProcessCollection.EditByKey(MObj.Key);
    // Simple startup without parameters
    SingleStarter := Process.StarterFactory.Single;
    SingleStarter.Deadline := DateTime.AddDays(DateTime.Now, 2);
    SingleStarter.RoleSid := "PS-1-1"// Admin
    SingleStarter.CheckAllLevels := False;
    // Start process instance
    SingleStarter.Start;
    // View startup result
    Debug.WriteLine("Start Result = " + SingleStarter.StartResult.ToString);
    Debug.WriteLine("Instance Id = " + SingleStarter.StartedInstanceId.ToString);
    Debug.WriteLine("Instance Guid = " + SingleStarter.StartedInstance.Guid);
End Sub UserProc;

After executing the example the object that is used to start process is obtained. Startup settings are determined, after this the process instance is started. Information about the process instance is displayed in the development environment console.

See also:

IBProcessStarterFactory