Interface IWorkflowAgent
Interface for the Workflow Agent Agent lets you configure workflow automation
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Workflow Agent", "Interface for the Workflow Agent. Agent lets you configure workflow automation")]
public interface 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...
}
}
Methods
AddAfterWorkflowStepAsync(int, WorkflowStepBase, CancellationToken)
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
Task<WorkflowStepBase> AddAfterWorkflowStepAsync(int workflowStepId, WorkflowStepBase subStep, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowStepId | Primary key of WorkflowStep |
| WorkflowStepBase | subStep | The step to be inserted after given step id. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowStepBase> | The added step |
ConnectEmailFlowContentAsync(int, int, CancellationToken)
Link any SMessage to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.
Declaration
Task ConnectEmailFlowContentAsync(int emailFlowId, int messageId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The EmailFlow to connect the message to. |
| int | messageId | The s_message to connect to the flow. A shipment, form or flow may be connected to that s_message. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
CopyEmailFlowAsync(int, string, CancellationToken)
Copy an email flow.
Declaration
Task<int> CopyEmailFlowAsync(int emailFlowId, string newName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The EmailFlow to copy. |
| string | newName | The name of the new email flow |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Newly created email flow id for this content |
CopyEmailFlowContentAsync(int, int, CancellationToken)
Copy smessage and connected shipment to the email flow. The SMessage (and any related SShipment etc) should probably not be used/visible elsewhere.
Declaration
Task<int> CopyEmailFlowContentAsync(int emailFlowId, int shipmentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The EmailFlow to connect the copied content to. |
| int | shipmentId | The id of the shipment to copy to the flow. The message of this shipment will also be connected |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Newly created shipment id for this content |
CreateDefaultEmailFlowAsync(CancellationToken)
Loading default values into a new EmailFlow.
Declaration
Task<EmailFlow> CreateDefaultEmailFlowAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EmailFlow> | New EmailFlow with default values |
CreateDefaultWorkflowEventAsync(CancellationToken)
Loading default values into a new WorkflowEvent.
Declaration
Task<WorkflowEvent> CreateDefaultWorkflowEventAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowEvent> | New WorkflowEvent with default values |
CreateDefaultWorkflowEventResultAsync(CancellationToken)
Loading default values into a new WorkflowEventResult.
Declaration
Task<WorkflowEventResult> CreateDefaultWorkflowEventResultAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowEventResult> | New WorkflowEventResult with default values |
CreateDefaultWorkflowFilterAsync(CancellationToken)
Loading default values into a new WorkflowFilter.
Declaration
Task<WorkflowFilter> CreateDefaultWorkflowFilterAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowFilter> | New WorkflowFilter with default values |
CreateDefaultWorkflowGoalAsync(CancellationToken)
Loading default values into a new WorkflowGoal.
Declaration
Task<WorkflowGoal> CreateDefaultWorkflowGoalAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowGoal> | New WorkflowGoal with default values |
CreateDefaultWorkflowStepFromTypeAsync(WorkflowStepType, CancellationToken)
Creates a new carrier from the step type given, with the right kind of properties, defaults set.
Declaration
Task<WorkflowStepBase> CreateDefaultWorkflowStepFromTypeAsync(WorkflowStepType stepType, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowStepType | stepType | Step type to create |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowStepBase> |
CreateDefaultWorkflowStepOptionFromTypeAsync(WorkflowSplitOptionType, CancellationToken)
Creates a new carrier from the option type given, with the right kind of properties, defaults set.
Declaration
Task<WorkflowStepOptionBase> CreateDefaultWorkflowStepOptionFromTypeAsync(WorkflowSplitOptionType optionType, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowSplitOptionType | optionType | Option type to create |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowStepOptionBase> |
CreateDefaultWorkflowTriggerAsync(CancellationToken)
Loading default values into a new WorkflowTrigger.
Declaration
Task<WorkflowTrigger> CreateDefaultWorkflowTriggerAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowTrigger> | New WorkflowTrigger with default values |
CreateDefaultWorkflowWaitForActionAsync(CancellationToken)
Loading default values into a new WorkflowWaitForAction.
Declaration
Task<WorkflowWaitForAction> CreateDefaultWorkflowWaitForActionAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowWaitForAction> | New WorkflowWaitForAction with default values |
CreateEmailFlowContentAsync(int, string, CancellationToken)
Create content to an email flow
Declaration
Task<int> CreateEmailFlowContentAsync(int emailFlowId, string contentName, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The EmailFlow to connect the created message to. |
| string | contentName | The name of the content created |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Id of shipment created |
DeleteEmailFlowAsync(int, CancellationToken)
Deletes the EmailFlow
Declaration
Task DeleteEmailFlowAsync(int emailFlowId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The identity of the EmailFlow |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteWorkflowGoalAsync(int, CancellationToken)
Deletes the WorkflowGoal
Declaration
Task DeleteWorkflowGoalAsync(int workflowGoalId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowGoalId | The identity of the WorkflowGoal |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteWorkflowTriggerAsync(int, CancellationToken)
Deletes the WorkflowTrigger
Declaration
Task DeleteWorkflowTriggerAsync(int workflowTriggerId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowTriggerId | The identity of the WorkflowTrigger |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteWorkflowWaitForActionAsync(int, CancellationToken)
Deletes the WorkflowWaitForAction
Declaration
Task DeleteWorkflowWaitForActionAsync(int workflowWaitForActionId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowWaitForActionId | The identity of the WorkflowWaitForAction |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
GetEmailFlowAsync(int, CancellationToken)
Gets a EmailFlow object.
Declaration
Task<EmailFlow> GetEmailFlowAsync(int emailFlowId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The identifier of the EmailFlow object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EmailFlow> | A single EmailFlow |
GetWorkflowGoalAsync(int, CancellationToken)
Gets a WorkflowGoal object.
Declaration
Task<WorkflowGoal> GetWorkflowGoalAsync(int workflowGoalId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowGoalId | The identifier of the WorkflowGoal object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowGoal> | A single WorkflowGoal |
GetWorkflowStepAsync(int, CancellationToken)
Get Workflowstep by ID
Declaration
Task<WorkflowStepBase> GetWorkflowStepAsync(int workflowStepId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowStepId | Primary key of WorkflowStep |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowStepBase> | The Workflow step |
GetWorkflowStepOptionAsync(int, CancellationToken)
Get WorkflowStepOption by ID
Declaration
Task<WorkflowStepOptionBase> GetWorkflowStepOptionAsync(int workflowStepOptionId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowStepOptionId | Primary key of WorkflowStep option |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowStepOptionBase> | The Workflow step option |
GetWorkflowTriggerAsync(int, CancellationToken)
Gets a WorkflowTrigger object.
Declaration
Task<WorkflowTrigger> GetWorkflowTriggerAsync(int workflowTriggerId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowTriggerId | The identifier of the WorkflowTrigger object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowTrigger> | A single WorkflowTrigger |
GetWorkflowWaitForActionAsync(int, CancellationToken)
Gets a WorkflowWaitForAction object.
Declaration
Task<WorkflowWaitForAction> GetWorkflowWaitForActionAsync(int workflowWaitForActionId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | workflowWaitForActionId | The identifier of the WorkflowWaitForAction object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowWaitForAction> | A single WorkflowWaitForAction |
RemoveParticipantsFromEmailFlowAsync(int, int[], CancellationToken)
Remove participants (actually workflow instances) from the workflow
Declaration
Task RemoveParticipantsFromEmailFlowAsync(int emailFlowId, int[] workflowInstanceIds, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | Primary key of EmailFlow |
| int[] | workflowInstanceIds | Array of Workflow instances (representing participants) to be completely removed from the workflow |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
RunAsync(CancellationToken)
Run the workflow engine right now
Declaration
Task<DateTime> RunAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<DateTime> | Suggested time for next run |
SaveEmailFlowAsync(EmailFlow, CancellationToken)
Updates the existing EmailFlow or creates a new EmailFlow if the id parameter is 0.
Declaration
Task<EmailFlow> SaveEmailFlowAsync(EmailFlow emailFlow, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| EmailFlow | emailFlow | The EmailFlow that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EmailFlow> | New or updated EmailFlow |
SaveWorkflowGoalAsync(WorkflowGoal, CancellationToken)
Updates the existing WorkflowGoal or creates a new WorkflowGoal if the id parameter is 0.
Declaration
Task<WorkflowGoal> SaveWorkflowGoalAsync(WorkflowGoal workflowGoal, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowGoal | workflowGoal | The WorkflowGoal that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowGoal> | New or updated WorkflowGoal |
SaveWorkflowTriggerAsync(WorkflowTrigger, CancellationToken)
Updates the existing WorkflowTrigger or creates a new WorkflowTrigger if the id parameter is 0.
Declaration
Task<WorkflowTrigger> SaveWorkflowTriggerAsync(WorkflowTrigger workflowTrigger, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowTrigger | workflowTrigger | The WorkflowTrigger that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowTrigger> | New or updated WorkflowTrigger |
SaveWorkflowWaitForActionAsync(WorkflowWaitForAction, CancellationToken)
Updates the existing WorkflowWaitForAction or creates a new WorkflowWaitForAction if the id parameter is 0.
Declaration
Task<WorkflowWaitForAction> SaveWorkflowWaitForActionAsync(WorkflowWaitForAction workflowWaitForAction, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowWaitForAction | workflowWaitForAction | The WorkflowWaitForAction that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowWaitForAction> | New or updated WorkflowWaitForAction |
SendEventAsync(WorkflowEvent, CancellationToken)
Send a workflow event. Most event signaling will finish very quickly as they normally just change the state of a workflow instance
Declaration
Task<WorkflowEventResult> SendEventAsync(WorkflowEvent workflowEvent, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkflowEvent | workflowEvent | Information about the signaled event |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowEventResult> | Any relevant info about the event |
SetStatusOnWorkflowAsync(int, WorkflowDefinitionStatus, CancellationToken)
Set status on workflow, Run or pause flow
Declaration
Task<WorkflowDefinitionStatus> SetStatusOnWorkflowAsync(int emailFlowId, WorkflowDefinitionStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | The id of the email flow to run or pause |
| WorkflowDefinitionStatus | status | The new status |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<WorkflowDefinitionStatus> | The new status |
TryAddPersonsToEmailFlowAsync(int, int[], CancellationToken)
Try to add a participant to the EmailFlow. Same function available in PersonAgent
Declaration
Task<bool[]> TryAddPersonsToEmailFlowAsync(int emailFlowId, int[] personIds, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | Primary key of EmailFlow |
| int[] | personIds | Array of Person Ids |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool[]> | True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason |
UpdateFormSubmissionsAsync(int, CancellationToken)
Attempt to update stored field values for up to the given number of form submissions
Declaration
Task<int> UpdateFormSubmissionsAsync(int maxCount, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | maxCount | The maximum number of form submissions to attempt to save as form field values. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Number of form submissions converted |