Add(StepGroup: IBProcessStepGroup);
StepGroup. The group of steps that should be added to the collection.
The Add method adds the specified group of steps to the end of the collection.
The collection contains one group of steps by default. New groups of steps can be added if gateway is enabled for the stage.
Executing the example requires that the repository contains a process with the PROCESS identifier. At least one stage is created in the process.
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;
MDesc: IMetabaseObjectDescriptor;
Process: IBProcess;
Stage: IBProcessStage;
DefaultStepGruop, StepGroup: IBProcessStepGroup;
Step_: IBProcessStep;
Duration: IBPDuration;
Begin
Mb := MetabaseClass.Active;
MDesc := Mb.ItemById("PROCESS");
// Get process structure
Process := BProcessCollection.EditByKey(MDesc.Key);
// Get stage and group of steps by default
Stage := Process.Stages.Item(0);
DefaultStepGruop := Stage.StepGroups.Item(0);
// Gateway for stage
Stage.GatewayType := BProcessGatewayType.Parallel;
// Create a new step
Step_ := New BProcessManualTaskStep.Create("Manual action", Process);
Step_.Description := "Data collection";
Duration := Step_.MaxDuration;
Duration.Type := DurationType.Day;
Duration.Amount := 2;
Duration.IsAbsoluteLag := True;
Duration.AbsoluteLag := TimeSpan.FromHours(21).ToDouble;
// Add a step to the first group of steps
DefaultStepGruop.Steps.Add(Step_);
// Create a new group of steps and steps for it
StepGroup := New BProcessStepGroup.Create(Process);
Step_ := New BProcessManualTaskStep.Create("Manual action 1", Process);
Step_.Description := "Prepare materials";
StepGroup.Steps.Add(Step_);
Step_ := New BProcessManualTaskStep.Create("Manual action 2", Process);
Step_.Description := "Send materials to next processing stage";
StepGroup.Steps.Add(Step_);
// Add a group of steps to stage
Stage.StepGroups.Add(StepGroup);
// Save changes
Process.Save;
End Sub UserProc;
After executing the example the use of parallel gateway is enabled for the first stage. The step with manual action is added to the stage, for which execution time is set up. A group of steps consisting of two steps with manual action is created for execution in parallel to this step.
See also: