Class WorkflowAgent
Facade for the Workflow Agent Agent lets you configure workflow automation
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
public class WorkflowAgent : AgentBase<IWorkflowAgent>, IDisposable, IWorkflowAgent, IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
Constructors
WorkflowAgent()
Facade for the Workflow Agent Agent lets you configure workflow automation
Declaration
public WorkflowAgent()
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
Methods
AddAfterWorkflowStep(Int32, WorkflowStepBase)
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
public WorkflowStepBase AddAfterWorkflowStep(int workflowStepId, WorkflowStepBase subStep)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowStepId | Primary key of WorkflowStep |
WorkflowStepBase | subStep | The step to be inserted after given step id. |
Returns
Type | Description |
---|---|
WorkflowStepBase | The added step |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
ConnectEmailFlowContent(Int32, Int32)
Link any SMessage to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.
Declaration
public void ConnectEmailFlowContent(int emailFlowId, int messageId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The EmailFlow to connect the message to. |
Int32 | messageId | The s_message to connect to the flow. A shipment, form or flow may be connected to that s_message. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CopyEmailFlow(Int32, String)
Copy an email flow.
Declaration
public int CopyEmailFlow(int emailFlowId, string newName)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The EmailFlow to copy. |
String | newName | The name of the new email flow |
Returns
Type | Description |
---|---|
Int32 | Newly created email flow id for this content |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CopyEmailFlowContent(Int32, Int32)
Copy smessage and connected shipment to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.
Declaration
public int CopyEmailFlowContent(int emailFlowId, int shipmentId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The EmailFlow to connect the copied content to. |
Int32 | shipmentId | The id of the shipment to copy to the flow. The message of this shipment will also be connected |
Returns
Type | Description |
---|---|
Int32 | Newly created shipment id for this content |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultEmailFlow()
Loading default values into a new EmailFlow. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public EmailFlow CreateDefaultEmailFlow()
Returns
Type | Description |
---|---|
EmailFlow | New EmailFlow with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowEvent()
Loading default values into a new WorkflowEvent. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowEvent CreateDefaultWorkflowEvent()
Returns
Type | Description |
---|---|
WorkflowEvent | New WorkflowEvent with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowEventResult()
Loading default values into a new WorkflowEventResult. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowEventResult CreateDefaultWorkflowEventResult()
Returns
Type | Description |
---|---|
WorkflowEventResult | New WorkflowEventResult with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowFilter()
Loading default values into a new WorkflowFilter. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowFilter CreateDefaultWorkflowFilter()
Returns
Type | Description |
---|---|
WorkflowFilter | New WorkflowFilter with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowGoal()
Loading default values into a new WorkflowGoal. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowGoal CreateDefaultWorkflowGoal()
Returns
Type | Description |
---|---|
WorkflowGoal | New WorkflowGoal with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowStepFromType(WorkflowStepType)
Creates a new carrier from the step type given, with the right kind of properties, defaults set.
Declaration
public WorkflowStepBase CreateDefaultWorkflowStepFromType(WorkflowStepType stepType)
Parameters
Type | Name | Description |
---|---|---|
WorkflowStepType | stepType | Step type to create |
Returns
Type | Description |
---|---|
WorkflowStepBase |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowStepOptionFromType(WorkflowSplitOptionType)
Creates a new carrier from the option type given, with the right kind of properties, defaults set.
Declaration
public WorkflowStepOptionBase CreateDefaultWorkflowStepOptionFromType(WorkflowSplitOptionType optionType)
Parameters
Type | Name | Description |
---|---|---|
WorkflowSplitOptionType | optionType | Option type to create |
Returns
Type | Description |
---|---|
WorkflowStepOptionBase |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowTrigger()
Loading default values into a new WorkflowTrigger. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowTrigger CreateDefaultWorkflowTrigger()
Returns
Type | Description |
---|---|
WorkflowTrigger | New WorkflowTrigger with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateDefaultWorkflowWaitForAction()
Loading default values into a new WorkflowWaitForAction. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public WorkflowWaitForAction CreateDefaultWorkflowWaitForAction()
Returns
Type | Description |
---|---|
WorkflowWaitForAction | New WorkflowWaitForAction with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
CreateEmailFlowContent(Int32, String)
Create content to an email flow
Declaration
public int CreateEmailFlowContent(int emailFlowId, string contentName)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The EmailFlow to connect the created message to. |
String | contentName | The name of the content created |
Returns
Type | Description |
---|---|
Int32 | Id of shipment created |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
DeleteEmailFlow(Int32)
Deletes the EmailFlow
Declaration
public void DeleteEmailFlow(int emailFlowId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The identity of the EmailFlow |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
DeleteWorkflowGoal(Int32)
Deletes the WorkflowGoal
Declaration
public void DeleteWorkflowGoal(int workflowGoalId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowGoalId | The identity of the WorkflowGoal |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
DeleteWorkflowTrigger(Int32)
Deletes the WorkflowTrigger
Declaration
public void DeleteWorkflowTrigger(int workflowTriggerId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowTriggerId | The identity of the WorkflowTrigger |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
DeleteWorkflowWaitForAction(Int32)
Deletes the WorkflowWaitForAction
Declaration
public void DeleteWorkflowWaitForAction(int workflowWaitForActionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowWaitForActionId | The identity of the WorkflowWaitForAction |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetEmailFlow(Int32)
Gets a EmailFlow object.
Declaration
public EmailFlow GetEmailFlow(int emailFlowId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The identifier of the EmailFlow object |
Returns
Type | Description |
---|---|
EmailFlow | EmailFlow |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetWorkflowGoal(Int32)
Gets a WorkflowGoal object.
Declaration
public WorkflowGoal GetWorkflowGoal(int workflowGoalId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowGoalId | The identifier of the WorkflowGoal object |
Returns
Type | Description |
---|---|
WorkflowGoal | WorkflowGoal |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetWorkflowStep(Int32)
Get Workflowstep by ID
Declaration
public WorkflowStepBase GetWorkflowStep(int workflowStepId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowStepId | Primary key of WorkflowStep |
Returns
Type | Description |
---|---|
WorkflowStepBase | The Workflow step |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetWorkflowStepOption(Int32)
Get WorkflowStepOption by ID
Declaration
public WorkflowStepOptionBase GetWorkflowStepOption(int workflowStepOptionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowStepOptionId | Primary key of WorkflowStep option |
Returns
Type | Description |
---|---|
WorkflowStepOptionBase | The Workflow step option |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetWorkflowTrigger(Int32)
Gets a WorkflowTrigger object.
Declaration
public WorkflowTrigger GetWorkflowTrigger(int workflowTriggerId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowTriggerId | The identifier of the WorkflowTrigger object |
Returns
Type | Description |
---|---|
WorkflowTrigger | WorkflowTrigger |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
GetWorkflowWaitForAction(Int32)
Gets a WorkflowWaitForAction object.
Declaration
public WorkflowWaitForAction GetWorkflowWaitForAction(int workflowWaitForActionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | workflowWaitForActionId | The identifier of the WorkflowWaitForAction object |
Returns
Type | Description |
---|---|
WorkflowWaitForAction | WorkflowWaitForAction |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
RemoveParticipantsFromEmailFlow(Int32, Int32[])
Remove participants (actually workflow instances) from the workflow
Declaration
public void RemoveParticipantsFromEmailFlow(int emailFlowId, int[] workflowInstanceIds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | Primary key of EmailFlow |
Int32[] | workflowInstanceIds | Array of Workflow instances (representing participants) to be completely removed from the workflow |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
Run()
Run the workflow engine right now
Declaration
public DateTime Run()
Returns
Type | Description |
---|---|
DateTime | Suggested time for next run |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SaveEmailFlow(EmailFlow)
Updates the existing EmailFlow or creates a new EmailFlow if the id parameter is empty
Declaration
public EmailFlow SaveEmailFlow(EmailFlow emailFlow)
Parameters
Type | Name | Description |
---|---|---|
EmailFlow | emailFlow | The EmailFlow that is saved. |
Returns
Type | Description |
---|---|
EmailFlow | New or updated EmailFlow |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SaveWorkflowGoal(WorkflowGoal)
Updates the existing WorkflowGoal or creates a new WorkflowGoal if the id parameter is empty
Declaration
public WorkflowGoal SaveWorkflowGoal(WorkflowGoal workflowGoal)
Parameters
Type | Name | Description |
---|---|---|
WorkflowGoal | workflowGoal | The WorkflowGoal that is saved. |
Returns
Type | Description |
---|---|
WorkflowGoal | New or updated WorkflowGoal |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SaveWorkflowTrigger(WorkflowTrigger)
Updates the existing WorkflowTrigger or creates a new WorkflowTrigger if the id parameter is empty
Declaration
public WorkflowTrigger SaveWorkflowTrigger(WorkflowTrigger workflowTrigger)
Parameters
Type | Name | Description |
---|---|---|
WorkflowTrigger | workflowTrigger | The WorkflowTrigger that is saved. |
Returns
Type | Description |
---|---|
WorkflowTrigger | New or updated WorkflowTrigger |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SaveWorkflowWaitForAction(WorkflowWaitForAction)
Updates the existing WorkflowWaitForAction or creates a new WorkflowWaitForAction if the id parameter is empty
Declaration
public WorkflowWaitForAction SaveWorkflowWaitForAction(WorkflowWaitForAction workflowWaitForAction)
Parameters
Type | Name | Description |
---|---|---|
WorkflowWaitForAction | workflowWaitForAction | The WorkflowWaitForAction that is saved. |
Returns
Type | Description |
---|---|
WorkflowWaitForAction | New or updated WorkflowWaitForAction |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SendEvent(WorkflowEvent)
Send a workflow event. Most event signaling will finish very quickly as they normally just change the state of a workflow instance
Declaration
public WorkflowEventResult SendEvent(WorkflowEvent workflowEvent)
Parameters
Type | Name | Description |
---|---|---|
WorkflowEvent | workflowEvent | Information about the signaled event |
Returns
Type | Description |
---|---|
WorkflowEventResult | Any relevant info about the event |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
SetStatusOnWorkflow(Int32, WorkflowDefinitionStatus)
Set status on workflow, Run or pause flow
Declaration
public WorkflowDefinitionStatus SetStatusOnWorkflow(int emailFlowId, WorkflowDefinitionStatus status)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | The id of the email flow to run or pause |
WorkflowDefinitionStatus | status | The new status |
Returns
Type | Description |
---|---|
WorkflowDefinitionStatus | The new status |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
TryAddPersonsToEmailFlow(Int32, Int32[])
Try to add a participant to the EmailFlow. Same function available in PersonAgent
Declaration
public bool[] TryAddPersonsToEmailFlow(int emailFlowId, int[] personIds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | Primary key of EmailFlow |
Int32[] | personIds | Array of Person Ids |
Returns
Type | Description |
---|---|
Boolean[] | True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}
UpdateFormSubmissions(Int32)
Attempt to update stored field values for up to the given number of form submissions
Declaration
public int UpdateFormSubmissions(int maxCount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | maxCount | The maximum number of form submissions to attempt to save as form field values. |
Returns
Type | Description |
---|---|
Int32 | Number of form submissions converted |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WorkflowAgent agent = new WorkflowAgent())
{
// call methods on agent here...
}
}