Class NSWorkflowAgent

Workflow data services.

Examples

NSWorkflowAgent agent;
agent.callMethod(arg1, arg2);

Constructors

NSWorkflowAgent()

Initializes a new instance of the NSWorkflowAgent class.

Declaration

NSWorkflowAgent

Examples

NSWorkflowAgent agent;
agent.callMethod(arg1, arg2);

Methods

CreateDefaultEmailFlow()

Loading default values into a new NSEmailFlow NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSEmailFlow CreateDefaultEmailFlow()

Examples

NSWorkflowAgent thing;
NSEmailFlow emailFlow = thing.CreateDefaultEmailFlow();

Returns

Type Description
NSEmailFlow New NSEmailFlow with default values.

SaveEmailFlow(NSEmailFlow)

Updates the existing NSEmailFlow or creates a new NSEmailFlow if the id parameter is empty

Declaration

NSEmailFlow SaveEmailFlow(NSEmailFlow emailFlow)

Examples

NSWorkflowAgent agent;
NSEmailFlow emailFlow;
NSEmailFlow res = agent.SaveEmailFlow(emailFlow);

Parameters

Type Name Description
NSEmailFlow emailFlow The NSEmailFlow that is saved.

Returns

Type Description
NSEmailFlow New or updated NSEmailFlow

DeleteEmailFlow(Integer)

Deletes the NSEmailFlow

Declaration

void DeleteEmailFlow(Integer emailFlowId)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
agent.DeleteEmailFlow(emailFlowId);

Parameters

Type Name Description
Integer emailFlowId The identity of the EmailFlow

CreateDefaultWorkflowEvent()

Loading default values into a new NSWorkflowEvent NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowEvent CreateDefaultWorkflowEvent()

Examples

NSWorkflowAgent agent;
NSWorkflowEvent event = agent.CreateDefaultWorkflowEvent();

Returns

Type Description
NSWorkflowEvent New NSWorkflowEvent with default values

CreateDefaultWorkflowEventResult()

Loading default values into a new NSWorkflowEventResult NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowEventResult CreateDefaultWorkflowEventResult()

Examples

NSWorkflowAgent agent;
NSWorkflowEventResult result = agent.CreateDefaultWorkflowEventResult();

Returns

Type Description
NSWorkflowEventResult New NSWorkflowEventResult with default values

CreateDefaultWorkflowFilter()

Loading default values into a new NSWorkflowFilter NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowFilter CreateDefaultWorkflowFilter()

Examples

NSWorkflowAgent agent;
NSWorkflowFilter filter = agent.CreateDefaultWorkflowFilter();

Returns

Type Description
NSWorkflowFilter New NSWorkflowFilter with default values

CreateDefaultWorkflowGoal()

Loading default values into a new NSWorkflowGoal NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowGoal CreateDefaultWorkflowGoal()

Examples

NSWorkflowAgent agent;
NSWorkflowGoal goal = agent.CreateDefaultWorkflowGoal();

Returns

Type Description
NSWorkflowGoal New NSWorkflowGoal with default values

SaveWorkflowGoal(NSWorkflowGoal)

Updates the existing NSWorkflowGoal or creates a new NSWorkflowGoal if the id parameter is empty

Declaration

NSWorkflowGoal SaveWorkflowGoal(NSWorkflowGoal workflowGoal)

Examples

NSWorkflowAgent agent;
NSWorkflowGoal goal;
NSWorkflowGoal res = agent.SaveWorkflowGoal(goal);

Parameters

Type Name Description
NSWorkflowGoal workflowGoal The NSWorkflowGoal that is saved.

Returns

Type Description
NSWorkflowGoal New or updated NSWorkflowGoal

DeleteWorkflowGoal(Integer)

Deletes the NSWorkflowGoal

Declaration

void DeleteWorkflowGoal(Integer workflowGoalId)

Examples

NSWorkflowAgent agent;
Integer workflowGoalId;
agent.DeleteWorkflowGoal(workflowGoalId);

Parameters

Type Name Description
Integer workflowGoalId The identity of the WorkflowGoal

CreateDefaultWorkflowTrigger()

Loading default values into a new NSWorkflowTrigger NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowTrigger CreateDefaultWorkflowTrigger()

Examples

NSWorkflowAgent agent;
NSWorkflowTrigger trigger = agent.CreateDefaultWorkflowTrigger();

Returns

Type Description
NSWorkflowTrigger New NSWorkflowTrigger with default values

SaveWorkflowTrigger(NSWorkflowTrigger)

Updates the existing NSWorkflowTrigger or creates a new NSWorkflowTrigger if the id parameter is empty

Declaration

NSWorkflowTrigger SaveWorkflowTrigger(NSWorkflowTrigger workflowTrigger)

Examples

NSWorkflowAgent agent;
NSWorkflowTrigger trigger;
NSWorkflowTrigger res = agent.SaveWorkflowTrigger(trigger);

Parameters

Type Name Description
NSWorkflowTrigger workflowTrigger The NSWorkflowTrigger that is saved.

Returns

Type Description
NSWorkflowTrigger New or updated NSWorkflowTrigger

DeleteWorkflowTrigger(Integer)

Deletes the NSWorkflowTrigger

Declaration

void DeleteWorkflowTrigger(Integer workflowTriggerId)

Examples

NSWorkflowAgent agent;
Integer workflowTriggerId;
agent.DeleteWorkflowTrigger(workflowTriggerId);

Parameters

Type Name Description
Integer workflowTriggerId The identity of the WorkflowTrigger

CreateDefaultWorkflowWaitForAction()

Loading default values into a new NSWorkflowWaitForAction NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration

NSWorkflowWaitForAction CreateDefaultWorkflowWaitForAction()

Examples

NSWorkflowAgent agent;
NSWorkflowWaitForAction action = agent.CreateDefaultWorkflowWaitForAction();

Returns

Type Description
NSWorkflowWaitForAction New NSWorkflowWaitForAction with default values

SaveWorkflowWaitForAction(NSWorkflowWaitForAction)

Updates the existing NSWorkflowWaitForAction or creates a new NSWorkflowWaitForAction if the id parameter is empty

Declaration

NSWorkflowWaitForAction SaveWorkflowWaitForAction(NSWorkflowWaitForAction workflowWaitForAction)

Examples

NSWorkflowAgent agent;
NSWorkflowWaitForAction action;
NSWorkflowWaitForAction res = agent.SaveWorkflowWaitForAction(action);

Parameters

Type Name Description
NSWorkflowWaitForAction workflowWaitForAction The NSWorkflowWaitForAction that is saved.

Returns

Type Description
NSWorkflowWaitForAction New or updated NSWorkflowWaitForAction

DeleteWorkflowWaitForAction(Integer)

Deletes the NSWorkflowWaitForAction

Declaration

void DeleteWorkflowWaitForAction(Integer workflowWaitForActionId)

Examples

NSWorkflowAgent agent;
Integer workflowWaitForActionId;
agent.DeleteWorkflowWaitForAction(workflowWaitForActionId);

Parameters

Type Name Description
Integer workflowWaitForActionId The identity of the WorkflowWaitForAction

GetEmailFlow(Integer)

Gets a NSEmailFlow object.

Declaration

NSEmailFlow GetEmailFlow(Integer emailFlowId)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
NSEmailFlow flow = agent.GetEmailFlow(emailFlowId);

Parameters

Type Name Description
Integer emailFlowId The identifier of the NSEmailFlow object

Returns

Type Description
NSEmailFlow NSEmailFlow

TryAddPersonsToEmailFlow(Integer,Integer[])

Try to add a participant to the EmailFlow. Same function available in PersonAgent

Declaration

Bool[] TryAddPersonsToEmailFlow(Integer emailFlowId, Integer[] personIds)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
Integer[] personIds;
Bool[] res = agent.TryAddPersonsToEmailFlow(emailFlowId, personIds);

Parameters

Type Name Description
Integer emailFlowId Primary key of EmailFlow
Integer[] personIds Array of Person Ids

Returns

Type Description
Bool[] True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason

RemoveParticipantsFromEmailFlow(Integer,Integer[])

Remove participants (actually workflow instances) from the workflow

Declaration

void RemoveParticipantsFromEmailFlow(Integer emailFlowId, Integer[] workflowInstanceIds)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
Integer[] workflowInstanceIds;
agent.RemoveParticipantsFromEmailFlow(emailFlowId, workflowInstanceIds);

Parameters

Type Name Description
Integer emailFlowId Primary key of EmailFlow
Integer[] workflowInstanceIds Array of Workflow instances (representing participants) to be completely removed from the workflow

CreateEmailFlowContent(Integer,String)

Create content to an email flow

Declaration

Integer CreateEmailFlowContent(Integer emailFlowId, String contentName)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
String contentName;
Integer res = agent.CreateEmailFlowContent(emailFlowId, contentName);

Parameters

Type Name Description
Integer emailFlowId The EmailFlow to connect the created message to.
String contentName The name of the content created

Returns

Type Description
Integer Id of shipment created

ConnectEmailFlowContent(Integer,Integer)

Link any SMessage to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.

Declaration

void ConnectEmailFlowContent(Integer emailFlowId, Integer messageId)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
Integer messageId;
agent.ConnectEmailFlowContent(emailFlowId, messageId);

Parameters

Type Name Description
Integer emailFlowId The EmailFlow to connect the message to.
Integer messageId The s_message to connect to the flow. A shipment, form or flow may be connected to that s_message.

CopyEmailFlowContent(Integer,Integer)

Copy smessage and connected shipment to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.

Declaration

Integer CopyEmailFlowContent(Integer emailFlowId, Integer shipmentId)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
Integer shipmentId;
Integer res = agent.CopyEmailFlowContent(emailFlowId, shipmentId);

Parameters

Type Name Description
Integer emailFlowId The EmailFlow to connect the copied content to.
Integer shipmentId The id of the shipment to copy to the flow. The message of this shipment will also be connected

Returns

Type Description
Integer Newly created shipment id for this content

UpdateFormSubmissions(Integer)

Attempt to update stored field values for up to the given number of form submissions

Declaration

Integer UpdateFormSubmissions(Integer maxCount)

Examples

NSWorkflowAgent agent;
Integer maxCount;
Integer res = agent.UpdateFormSubmissions(maxCount);

Parameters

Type Name Description
Integer maxCount The maximum number of form submissions to attempt to save as form field values.

Returns

Type Description
Integer Number of form submissions converted

SetStatusOnWorkflow(Integer,WorkflowDefinitionStatus)

Set status on workflow, Run or pause flow

Declaration

WorkflowDefinitionStatus SetStatusOnWorkflow(Integer emailFlowId, WorkflowDefinitionStatus status)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
WorkflowDefinitionStatus status;
WorkflowDefinitionStatus res = agent.SetStatusOnWorkflow(emailFlowId, status);

Parameters

Type Name Description
Integer emailFlowId The id of the email flow to run or pause
WorkflowDefinitionStatus status The new status

Returns

Type Description
WorkflowDefinitionStatus The new status

CopyEmailFlow(Integer,String)

Copy an email flow.

Declaration

Integer CopyEmailFlow(Integer emailFlowId, String newName)

Examples

NSWorkflowAgent agent;
Integer emailFlowId;
String newName;
Integer res = agent.CopyEmailFlow(emailFlowId, newName);

Parameters

Type Name Description
Integer emailFlowId The EmailFlow to copy.
String newName The name of the new email flow

Returns

Type Description
Integer Newly created email flow id for this content

Run()

Run the workflow engine right now

Declaration

DateTime Run()

Examples

NSWorkflowAgent agent;
DateTime nextRun = agent.Run();

Returns

Type Description
DateTime Suggested time for next run

SendEvent(NSWorkflowEvent)

Send a workflow event. Most event signaling will finish very quickly as they normally just change the state of a workflow instance

Declaration

NSWorkflowEventResult SendEvent(NSWorkflowEvent workflowEvent)

Examples

NSWorkflowAgent agent;
NSWorkflowEvent event;
NSWorkflowEventResult res = agent.SendEvent(event);

Parameters

Type Name Description
NSWorkflowEvent workflowEvent Information about the signaled event

Returns

Type Description
NSWorkflowEventResult Any relevant info about the event

GetWorkflowGoal(Integer)

Gets a NSWorkflowGoal object.

Declaration

NSWorkflowGoal GetWorkflowGoal(Integer workflowGoalId)

Examples

NSWorkflowAgent agent;
Integer workflowGoalId;
NSWorkflowGoal goal = agent.GetWorkflowGoal(workflowGoalId);

Parameters

Type Name Description
Integer workflowGoalId The identifier of the NSWorkflowGoal object

Returns

Type Description
NSWorkflowGoal NSWorkflowGoal

GetWorkflowStep(Integer)

Get Workflowstep by ID

Declaration

NSWorkflowStepBase GetWorkflowStep(Integer workflowStepId)

Examples

NSWorkflowAgent agent;
Integer workflowStepId;
NSWorkflowStepBase step = agent.GetWorkflowStep(workflowStepId);

Parameters

Type Name Description
Integer workflowStepId Primary key of WorkflowStep

Returns

Type Description
NSWorkflowStepBase The Workflow step

AddAfterWorkflowStep(Integer,NSWorkflowStepBase)

Add another step (and any of its substeps) after the given step id (which must exist), and move any following steps in the workflow further down the line.

Declaration

NSWorkflowStepBase AddAfterWorkflowStep(Integer workflowStepId, NSWorkflowStepBase subStep)

Examples

NSWorkflowAgent agent;
Integer workflowStepId;
NSWorkflowStepBase subStep;
NSWorkflowStepBase res = agent.AddAfterWorkflowStep(workflowStepId, subStep);

Parameters

Type Name Description
Integer workflowStepId Primary key of WorkflowStep
NSWorkflowStepBase subStep The step to be inserted after given step id.

Returns

Type Description
NSWorkflowStepBase The added step

CreateDefaultWorkflowStepFromType(WorkflowStepType)

Creates a new carrier from the step type given, with the right kind of properties, defaults set.

Declaration

NSWorkflowStepBase CreateDefaultWorkflowStepFromType(WorkflowStepType stepType)

Examples

NSWorkflowAgent agent;
WorkflowStepType stepType;
NSWorkflowStepBase res = agent.CreateDefaultWorkflowStepFromType(stepType);

Parameters

Type Name Description
WorkflowStepType stepType Step type to create

Returns

Type Description
NSWorkflowStepBase The created workflow step

GetWorkflowTrigger(Integer)

Gets a NSWorkflowTrigger object.

Declaration

NSWorkflowTrigger GetWorkflowTrigger(Integer workflowTriggerId)

Examples

NSWorkflowAgent agent;
Integer workflowTriggerId;
NSWorkflowTrigger trigger = agent.GetWorkflowTrigger(workflowTriggerId);

Parameters

Type Name Description
Integer workflowTriggerId The identifier of the NSWorkflowTrigger object

Returns

Type Description
NSWorkflowTrigger NSWorkflowTrigger

GetWorkflowWaitForAction(Integer)

Gets a NSWorkflowWaitForAction object.

Declaration

NSWorkflowWaitForAction GetWorkflowWaitForAction(Integer workflowWaitForActionId)

Examples

NSWorkflowAgent agent;
Integer workflowWaitForActionId;
NSWorkflowWaitForAction action = agent.GetWorkflowWaitForAction(workflowWaitForActionId);

Parameters

Type Name Description
Integer workflowWaitForActionId The identifier of the NSWorkflowWaitForAction object

Returns

Type Description
NSWorkflowWaitForAction NSWorkflowWaitForAction

CreateDefaultWorkflowStepOptionFromType(WorkflowSplitOptionType)

Creates a new carrier from the option type given, with the right kind of properties, defaults set.

Declaration

NSWorkflowStepOptionBase CreateDefaultWorkflowStepOptionFromType(WorkflowSplitOptionType optionType)

Parameters

Type Name Description
optionType Option type to create.

Returns

Type Description
NSWorkflowStepOptionBase The created workflow step option.

GetWorkflowStepOption(Integer)

Get WorkflowStepOption by ID.

Declaration

NSWorkflowStepOptionBase GetWorkflowStepOption(Integer workflowStepOptionId)

Parameters

Type Name Description
Integer workflowStepOptionId Primary key of WorkflowStep option.

Returns

Type Description
NSWorkflowStepOptionBase The Workflow step option.