Class NSWorkflowAgent
Workflow data services.
Syntax
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
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)
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 |
Examples
NSWorkflowAgent agent;
Integer workflowStepId;
NSWorkflowStepBase subStep;
NSWorkflowStepBase res = agent.AddAfterWorkflowStep(workflowStepId, subStep);
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)
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. |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
Integer messageId;
agent.ConnectEmailFlowContent(emailFlowId, messageId);
CopyEmailFlow(Integer,String)
Copy an email flow.
Declaration
Integer CopyEmailFlow(Integer emailFlowId, String 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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
String newName;
Integer res = agent.CopyEmailFlow(emailFlowId, newName);
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)
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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
Integer shipmentId;
Integer res = agent.CopyEmailFlowContent(emailFlowId, shipmentId);
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()
Returns
Type | Description |
---|---|
NSEmailFlow | New NSEmailFlow with default values. |
Examples
NSWorkflowAgent thing;
NSEmailFlow emailFlow = thing.CreateDefaultEmailFlow();
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()
Returns
Type | Description |
---|---|
NSWorkflowEvent | New NSWorkflowEvent with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowEvent event = agent.CreateDefaultWorkflowEvent();
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()
Returns
Type | Description |
---|---|
NSWorkflowEventResult | New NSWorkflowEventResult with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowEventResult result = agent.CreateDefaultWorkflowEventResult();
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()
Returns
Type | Description |
---|---|
NSWorkflowFilter | New NSWorkflowFilter with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowFilter filter = agent.CreateDefaultWorkflowFilter();
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()
Returns
Type | Description |
---|---|
NSWorkflowGoal | New NSWorkflowGoal with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowGoal goal = agent.CreateDefaultWorkflowGoal();
CreateDefaultWorkflowStepFromType(WorkflowStepType)
Creates a new carrier from the step type given, with the right kind of properties, defaults set.
Declaration
NSWorkflowStepBase CreateDefaultWorkflowStepFromType(WorkflowStepType stepType)
Parameters
Type | Name | Description |
---|---|---|
WorkflowStepType | stepType | Step type to create |
Returns
Type | Description |
---|---|
NSWorkflowStepBase | The created workflow step |
Examples
NSWorkflowAgent agent;
WorkflowStepType stepType;
NSWorkflowStepBase res = agent.CreateDefaultWorkflowStepFromType(stepType);
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. |
Examples
NSWorkflowAgent agent;
agent.callMethod(arg1, arg2);
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()
Returns
Type | Description |
---|---|
NSWorkflowTrigger | New NSWorkflowTrigger with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowTrigger trigger = agent.CreateDefaultWorkflowTrigger();
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()
Returns
Type | Description |
---|---|
NSWorkflowWaitForAction | New NSWorkflowWaitForAction with default values |
Examples
NSWorkflowAgent agent;
NSWorkflowWaitForAction action = agent.CreateDefaultWorkflowWaitForAction();
CreateEmailFlowContent(Integer,String)
Create content to an email flow
Declaration
Integer CreateEmailFlowContent(Integer emailFlowId, String 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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
String contentName;
Integer res = agent.CreateEmailFlowContent(emailFlowId, contentName);
DeleteEmailFlow(Integer)
Deletes the NSEmailFlow
Declaration
void DeleteEmailFlow(Integer emailFlowId)
Parameters
Type | Name | Description |
---|---|---|
Integer | emailFlowId | The identity of the EmailFlow |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
agent.DeleteEmailFlow(emailFlowId);
DeleteWorkflowGoal(Integer)
Deletes the NSWorkflowGoal
Declaration
void DeleteWorkflowGoal(Integer workflowGoalId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowGoalId | The identity of the WorkflowGoal |
Examples
NSWorkflowAgent agent;
Integer workflowGoalId;
agent.DeleteWorkflowGoal(workflowGoalId);
DeleteWorkflowTrigger(Integer)
Deletes the NSWorkflowTrigger
Declaration
void DeleteWorkflowTrigger(Integer workflowTriggerId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowTriggerId | The identity of the WorkflowTrigger |
Examples
NSWorkflowAgent agent;
Integer workflowTriggerId;
agent.DeleteWorkflowTrigger(workflowTriggerId);
DeleteWorkflowWaitForAction(Integer)
Deletes the NSWorkflowWaitForAction
Declaration
void DeleteWorkflowWaitForAction(Integer workflowWaitForActionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowWaitForActionId | The identity of the WorkflowWaitForAction |
Examples
NSWorkflowAgent agent;
Integer workflowWaitForActionId;
agent.DeleteWorkflowWaitForAction(workflowWaitForActionId);
GetEmailFlow(Integer)
Gets a NSEmailFlow object.
Declaration
NSEmailFlow GetEmailFlow(Integer emailFlowId)
Parameters
Type | Name | Description |
---|---|---|
Integer | emailFlowId | The identifier of the NSEmailFlow object |
Returns
Type | Description |
---|---|
NSEmailFlow | NSEmailFlow |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
NSEmailFlow flow = agent.GetEmailFlow(emailFlowId);
GetWorkflowGoal(Integer)
Gets a NSWorkflowGoal object.
Declaration
NSWorkflowGoal GetWorkflowGoal(Integer workflowGoalId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowGoalId | The identifier of the NSWorkflowGoal object |
Returns
Type | Description |
---|---|
NSWorkflowGoal | NSWorkflowGoal |
Examples
NSWorkflowAgent agent;
Integer workflowGoalId;
NSWorkflowGoal goal = agent.GetWorkflowGoal(workflowGoalId);
GetWorkflowStep(Integer)
Get Workflowstep by ID
Declaration
NSWorkflowStepBase GetWorkflowStep(Integer workflowStepId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowStepId | Primary key of WorkflowStep |
Returns
Type | Description |
---|---|
NSWorkflowStepBase | The Workflow step |
Examples
NSWorkflowAgent agent;
Integer workflowStepId;
NSWorkflowStepBase step = agent.GetWorkflowStep(workflowStepId);
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. |
Examples
NSWorkflowAgent agent;
agent.callMethod(arg1, arg2);
GetWorkflowTrigger(Integer)
Gets a NSWorkflowTrigger object.
Declaration
NSWorkflowTrigger GetWorkflowTrigger(Integer workflowTriggerId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowTriggerId | The identifier of the NSWorkflowTrigger object |
Returns
Type | Description |
---|---|
NSWorkflowTrigger | NSWorkflowTrigger |
Examples
NSWorkflowAgent agent;
Integer workflowTriggerId;
NSWorkflowTrigger trigger = agent.GetWorkflowTrigger(workflowTriggerId);
GetWorkflowWaitForAction(Integer)
Gets a NSWorkflowWaitForAction object.
Declaration
NSWorkflowWaitForAction GetWorkflowWaitForAction(Integer workflowWaitForActionId)
Parameters
Type | Name | Description |
---|---|---|
Integer | workflowWaitForActionId | The identifier of the NSWorkflowWaitForAction object |
Returns
Type | Description |
---|---|
NSWorkflowWaitForAction | NSWorkflowWaitForAction |
Examples
NSWorkflowAgent agent;
Integer workflowWaitForActionId;
NSWorkflowWaitForAction action = agent.GetWorkflowWaitForAction(workflowWaitForActionId);
RemoveParticipantsFromEmailFlow(Integer,Integer[])
Remove participants (actually workflow instances) from the workflow
Declaration
void RemoveParticipantsFromEmailFlow(Integer emailFlowId, Integer[] 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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
Integer[] workflowInstanceIds;
agent.RemoveParticipantsFromEmailFlow(emailFlowId, workflowInstanceIds);
Run()
Run the workflow engine right now
Declaration
DateTime Run()
Returns
Type | Description |
---|---|
DateTime | Suggested time for next run |
Examples
NSWorkflowAgent agent;
DateTime nextRun = agent.Run();
SaveEmailFlow(NSEmailFlow)
Updates the existing NSEmailFlow or creates a new NSEmailFlow if the id parameter is empty
Declaration
NSEmailFlow SaveEmailFlow(NSEmailFlow emailFlow)
Parameters
Type | Name | Description |
---|---|---|
NSEmailFlow | emailFlow | The NSEmailFlow that is saved. |
Returns
Type | Description |
---|---|
NSEmailFlow | New or updated NSEmailFlow |
Examples
NSWorkflowAgent agent;
NSEmailFlow emailFlow;
NSEmailFlow res = agent.SaveEmailFlow(emailFlow);
SaveWorkflowGoal(NSWorkflowGoal)
Updates the existing NSWorkflowGoal or creates a new NSWorkflowGoal if the id parameter is empty
Declaration
NSWorkflowGoal SaveWorkflowGoal(NSWorkflowGoal workflowGoal)
Parameters
Type | Name | Description |
---|---|---|
NSWorkflowGoal | workflowGoal | The NSWorkflowGoal that is saved. |
Returns
Type | Description |
---|---|
NSWorkflowGoal | New or updated NSWorkflowGoal |
Examples
NSWorkflowAgent agent;
NSWorkflowGoal goal;
NSWorkflowGoal res = agent.SaveWorkflowGoal(goal);
SaveWorkflowTrigger(NSWorkflowTrigger)
Updates the existing NSWorkflowTrigger or creates a new NSWorkflowTrigger if the id parameter is empty
Declaration
NSWorkflowTrigger SaveWorkflowTrigger(NSWorkflowTrigger workflowTrigger)
Parameters
Type | Name | Description |
---|---|---|
NSWorkflowTrigger | workflowTrigger | The NSWorkflowTrigger that is saved. |
Returns
Type | Description |
---|---|
NSWorkflowTrigger | New or updated NSWorkflowTrigger |
Examples
NSWorkflowAgent agent;
NSWorkflowTrigger trigger;
NSWorkflowTrigger res = agent.SaveWorkflowTrigger(trigger);
SaveWorkflowWaitForAction(NSWorkflowWaitForAction)
Updates the existing NSWorkflowWaitForAction or creates a new NSWorkflowWaitForAction if the id parameter is empty
Declaration
NSWorkflowWaitForAction SaveWorkflowWaitForAction(NSWorkflowWaitForAction workflowWaitForAction)
Parameters
Type | Name | Description |
---|---|---|
NSWorkflowWaitForAction | workflowWaitForAction | The NSWorkflowWaitForAction that is saved. |
Returns
Type | Description |
---|---|
NSWorkflowWaitForAction | New or updated NSWorkflowWaitForAction |
Examples
NSWorkflowAgent agent;
NSWorkflowWaitForAction action;
NSWorkflowWaitForAction res = agent.SaveWorkflowWaitForAction(action);
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)
Parameters
Type | Name | Description |
---|---|---|
NSWorkflowEvent | workflowEvent | Information about the signaled event |
Returns
Type | Description |
---|---|
NSWorkflowEventResult | Any relevant info about the event |
Examples
NSWorkflowAgent agent;
NSWorkflowEvent event;
NSWorkflowEventResult res = agent.SendEvent(event);
SetStatusOnWorkflow(Integer,WorkflowDefinitionStatus)
Set status on workflow, Run or pause flow
Declaration
WorkflowDefinitionStatus SetStatusOnWorkflow(Integer emailFlowId, WorkflowDefinitionStatus 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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
WorkflowDefinitionStatus status;
WorkflowDefinitionStatus res = agent.SetStatusOnWorkflow(emailFlowId, status);
TryAddPersonsToEmailFlow(Integer,Integer[])
Try to add a participant to the EmailFlow. Same function available in PersonAgent
Declaration
Bool[] TryAddPersonsToEmailFlow(Integer emailFlowId, Integer[] 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 |
Examples
NSWorkflowAgent agent;
Integer emailFlowId;
Integer[] personIds;
Bool[] res = agent.TryAddPersonsToEmailFlow(emailFlowId, personIds);
UpdateFormSubmissions(Integer)
Attempt to update stored field values for up to the given number of form submissions
Declaration
Integer UpdateFormSubmissions(Integer 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 |
Examples
NSWorkflowAgent agent;
Integer maxCount;
Integer res = agent.UpdateFormSubmissions(maxCount);