Assignment Plugin API
This Plugin implements the basic functions for working with assignments.
The AssignmentPlugin use cases.
Assignment
Properties:
AssignmentId
: Guid
Unique id.
AssignmentCode
: String
Required assignment code.
ProcessId
: Guid
Required process id.
Name
: String
Required assignment name.
Description
: string
Assignment description.
DateCreation
: DateTime
Date of creation.
DateStart
: DateTime?
Date of start.
DateFinish
: DateTime?
Date of finish.
DeadlineToStart
: DateTime?
Deadline to start.
DeadlineToComplete
: DateTime?
Deadline to complete.
Executor
: String
Executor identity.
Observers
: List<String>
List of user identities.
Tags
: List<String>
List of tag.
StatusState
: String
Assignment status.
IsActive
: Boolean
Property for managing the assignment from the designer.
IsDeleted
: Boolean
If true, then the assignment is marked as deleted.
Settings
Setting_CheckDeadlineInterval
Allows changing auto deadline check interval. The default value is 1 minute. This setting can be applied only before the Workflow runtime is started.
assignmentPlugin.Setting_CheckDeadlineInterval = "10 seconds";
Setting_StartAutoCheckDeadlinesProcess
Enables auto check deadlines.
This function requires additional schema and dedicated process and won't work without license key.
assignmentPlugin.Setting_StartAutoCheckDeadlinesProcess = true;
WithStatuses
Method that overrides the default list of statuses.
Parameters:
statuses
: List<String>
List of new statuses. The list should contain the default status.
defaultStatus
: String
Default status. This status will be assigned to assignments when they are created.
OnDeadlineToStartAsync
The delegate that is called when AssignmentCheckDeadline is executed (DeadlineType: ToStart / All). There is no need to compare the deadline with the current time, this happens automatically on the plugin side.
Parameters:
assignment
: Assignment
Assignment for which the start deadline has been checked.
condition
: AssignmentCheckDeadlineCondition
Deadline check conditions.
Handler syntax:
async void CheckDeadlineToStart(Assignment assignment
AssignmentCheckDeadlineCondition condition)
{
if (condition == AssignmentCheckDeadlineCondition.Equal
&& assignment.StatusState == AssignmentPlugin.DefaultStatus)
{
assignment.Tags.Add("Overdue start deadline");
await Runtime.UpdateAssignmentAsync(assignment);
}
}
OnDeadlineToCompleteAsync
The delegate that is called when AssignmentCheckDeadline is executed (DeadlineType: ToComplete / All).There is no need to compare the deadline with the current time, this happens automatically on the plugin side.
Parameters:
assignment
: Assignment
Assignment for which the completion deadline has been checked.
condition
: AssignmentCheckDeadlineCondition
Deadline check conditions.
Handler syntax:
async void CheckDeadlineToComplete(Assignment assignment,
AssignmentCheckDeadlineCondition condition)
{
if (condition == AssignmentCheckDeadlineCondition.Equal
&& (assignment.StatusState == AssignmentPlugin.DefaultStatus
|| assignment.StatusState == AssignmentPlugin.DefaultStartStatus))
{
assignment.Tags.Add("Overdue finish deadline");
await Runtime.UpdateAssignmentAsync(assignment);
}
}
Actions
Read about actions.
AssignmentCreate
Creating new assignments.
Parameters:
Name
: String *
Required assignment name.
Code
: String *
Required assignment code.
Executors
: List<Executor> *
If IsActor: true
, then the assignment executors are all users belonging to the actor with
the Name: Value
. If IsActor: false
, then a specific user is the executor of the assignment and his identity is
in Value
.
Is active
: Boolean *
Property for managing the assignment from the designer.
Description
: String
Assignment description.
Deadline to start
: String
The string has the format: 1d 1h 1m 1s
.
The value is used to generate the deadline to start when the current action is executed.
Deadline to complete
: String
The string has the format: 1d 1h 1m 1s
.The value is used to generate the deadline to complete when the
current action is executed.
Observers
: List<UserIdentity>
List of observer UserIdentities.
Tags
: List<String>
List of tags.
AssignmentChange
Updating assignments.
Parameters:
Code
: String *
Required assignment code.
Replacement of executors
: List<ReplacementExecutor>
Executor replacement list.
If Value
in OldExecutor
is null
, then all old executors are selected for replacement.
If IsActor
in OldExecutor
is true
, then all old executors belonging to the specified actor are
selected for replacement.
If IsActor
in OldExecutor
is false
, then specific old executor is selected for replacement.
Change[Property]
: Boolean
Indicates whether to update the selected Property.
Status state
: String
New status for the assignment, if ChangeStatus
is selected.
Is active
: Boolean
New state for the assignment, if ChangeState
is selected.
Deadline to start
: String
New deadline to start for the assignment, if ChangeDeadlineToStart
is selected.
The string has the format: 1d 1h 1m 1s
.
The value is used to generate the deadline to start when the current action is executed.
Deadline to complete
: String
New deadline to complete for the assignment, if ChangeDeadlineToComplete
is selected.
The string has the format: 1d 1h 1m 1s
.
The value is used to generate the deadline to complete when the current action is executed.
Observers
: List<UserIdentity>
New list of observer UserIdentities, if ChangeObservers
is selected.
Tags
: List<String>
New list of tag strings, if ChangeTags
is selected.
AssignmentDelete
Deleting assignment.
Parameters:
Assignment code
: String *
Required assignment code.
Is hard removal
: Boolean *
if Is hard removal
is true
, assignment will be deleted permanently from the database.
if Is hard removal
is false
, assignment will be marked as deleted (IsDeleted:true
).
AssignmentCheckDeadline
Checking assignment deadlines.
Parameters:
Assignment code
: String
Required assignment code.
Check deadline condition
: AssignmentCheckDeadlineCondition *
Deadline comparison type.
Deadline type
: AssignmentDeadlineType *
The type of deadline to be checked.
Conditions
Read about conditions.
AssignmentsAny
Checks if at least one assignment exists in the current process. Assignments
with IsDeleted
: true are ignored.
AssignmentsAllHaveCertainStatus
Checks if all assignment sets with the specified Codes have a certain Status state.
Parameters:
Status state
: String *
Status for comparison.
Assignments
: List<AssignmentCodeConditionItem> *
List of AssignmentCodeConditionItem.
AssignmentsAnyHaveCertainStatus
Checks if at least one set of assignments with the specified Code have a certain Status state.
Parameters:
Status state
: String *
Status for comparison
Assignments
: List<AssignmentCodeConditionItem> *
List of AssignmentCodeConditionItem.
Elements
AssignmentCheckDeadlineCondition
Allowable values:
- Equal (accurate to the minute)
- Expired
- NotExpired
AssignmentDeadlineType
Allowable values:
- ToStart
- ToComplete
- All (both deadline types)
AssignmentCodeCondition
Allowable values:
- All
- Any
UserIdentity
class UserIdentity
{
// unique user id
public string Identity { get; set; }
// user name
public string UserName { get; set; }
}
Executor
class Executor
{
public string Value { get; set; }
public string Name { get; set; }
public bool IsActor { get; set; }
}
ReplacementExecutor
class ReplacementExecutor
{
public Executor OldExecutor { get; set; }
public UserIdentity NewExecutor { get; set; }
}
AssignmentCodeConditionItem
class AssignmentCodeConditionItem
{
public string Code { get; set; }
public AssignmentCodeCondition Condition { get; set; }
}