Basic Plugin API
This Plugin implements the most common functions for handling processes, parameters, etc.
Settings
Setting_DontCompileExpressions
Boolean true
- disable compilation of expressions in parameters;
false
- enable compilation.
Setting_Mailserver
A String that contains the name or IP address of the host used for SMTP transactions.
Used for SendEmail.
Setting_MailserverPort
An Int32 greater than zero that contains the port to be used on host.
Setting_MailserverFrom
A String that contains the address of the sender of the email message.
Used for SendEmail.
Setting_MailserverLogin
The user name associated with the credentials.
Used for SendEmail.
Setting_MailserverPassword
A String that contains the password for the user name associated with the credentials.
Used for SendEmail.
Setting_MailserverSsl
Boolean: true
- ssl is enabled; false
- ssl is disabled. Read about
it here.
Used for SendEmail.
RequestHeaders
Dictionary of headers to be added to DefaultRequestHeaders for each request.
Used for HTTPRequest and CheckHTTPRequest.
ApproversInStageAsync
A delegate, your function should return all users of the current stage.
Task<IEnumerable<string>> MyApproversInStageAsync(string stageName,
ProcessInstance processInstance)
{
// Example: return id of all users of the signing process
if (stageName == "Signing")
{
return new List<string>() {myManagerId, myBossId};
}
return new List<string>();
}
Used for FillApproversUsers.
UsersInRoleAsync
A delegate, your function should return all users with the specified role.
Action syntax:
async Task<IEnumerable<string>> MyUsersInRoleAsync(string roleName,
ProcessInstance processInstance)
{
// Example: return id of all users who are managers
if (parameter == "Manager")
{
return new List<string>() {myManagerId1, myManagerId2};
}
return new List<string>();
}
Used for FillApproversRoles, IsApprovedByRoles and CheckRole
CheckPredefinedActorAsync
A delegate, your function should return: true
- if the user meets the specified rule
; false
- if the user doesn't meet the specified rule.
Handler syntax:
async Task<bool> CheckMyPredefinedActorAsync(ProcessInstance processInstance,
WorkflowRuntime runtime, string parameter,
string identityId)
{
// Example: check if the user with the specified Id is a manager
if (parameter == "Manager")
{
return identityId == myManagerId;
}
return false;
}
GetPredefinedIdentitiesAsync
A delegate, your function should return all users with the specified rule. Using this function, you can implement the rules both for the security system and for the given document. For example: document author, document manager, controller.
Handler syntax:
async Task<IEnumerable<string>> GetMyPredefinedIdentitiesAsync(ProcessInstance processInstance,
WorkflowRuntime runtime,
string parameter)
{
// Example: return id of all users who are managers
if (parameter == "Manager")
{
return new List<string>() {myManagerId1, myManagerId2};
}
return new List<string>();
}
UpdateDocumentStateAsync
A delegate that fires on ProcessStatusChanged event in WorkflowRuntime.
Handler syntax:
public static async Task UpdateMyDocumentStateAsync(ProcessInstance processInstance,
string stateName,
string localizedStateName)
{
// here you can update document state
myDoc.State = stateName;
}
Actions
Read about actions.
SetActivity
Moves the current process to the specified activity.
Parameters
Activity name
: String *
The name of the activity to be set for the process.
Set after
: SetAfter *
Defines the point of execution to set the activity.
Default value: AfterAction
SetState
Moves the current process to the specified state.
Parameters
State name
: String *
The name of the state to be set for the process.
Set after
: SetAfter *
Defines the point of execution to set the state.
Default value: AfterAction
SetParameter
Sets the value of the parameter for the current or root process. Only string values are supported.
Parameters
Parameter name
: String *
The name of the parameter with the value to be assigned.
Value
: String *
The value to be assigned.
For root process
: Boolean *
true
- parameter will be set for the root process;
false
- parameter will be set for the current process.
Default value: false
Read about subprocesses.
RemoveParameter
Removes the parameter for the current or root process.
Parameters:
Parameter name
: String *
The name of the parameter to be removed.
For root process
: Boolean *
true
- Parameter will be removed for the root process;
false
- Parameter will be removed for the current process.
Default value: false
Read about subprocesses.
HTTPRequest
Sends an HTTP(s) request to the specified URL (GET/POST).
Parameters:
Url
: String *
The URL the request is sent to.
UserName
: String
The user name to be used in NetworkCredential when creating a request.
Password
: String
The password to be used in NetworkCredential when creating a request.
Post
: Boolean
true
- post request; false
- get request.
Store response
: Boolean
true
- the response will be stored in the parameter with the specified name, whose type
is temporary; false
- the response won't be stored in a variable.
Parameter Name
: String
The name of the parameter to store the response.
Default value: HTTPRequest_Result
Parameter purpose
: ParameterPurpose *
ParameterPurpose defines the behavior for saving the parameter.
Default value: Temporary
Add process Id and scheme in parameters
: Boolean *
Only for post request. true
- process id will be added to the request parameters; false
- process id won't be added
to the request parameters.
Content type
: content type *
Only for post request. The response format.
Default value: Json
Headers
A string that is a set of key-value pairs to be added to DefaultRequestHeaders for the given request.
Example:
Name 1 = Value 1;
Name 2 = Value 2;
Name 3 = Value 3;
Parameters
Only for post request. The type parameters if the request specified in content type.
CreateProcess
Creates a new process according to the scheme.
Parameters:
Scheme
: String *
The scheme name.
Process Id
: Guid *
The id of the created process.
SendEmail
Sends a letter to the specified e-mail.
Parameters:
Mail server
: String *
A string that contains the name or IP address of the host used for SMTP transactions.
The value will be taken from Setting_Mailserver, if already specified.
Mail server port
: Int32 *
An Int32 greater than zero that contains the port to be used on host.
The value will be taken from Setting_MailserverPort, if already specified.
Mail server from
: String *
A string that contains the address of the sender of the email message.
The value will be taken from Setting_MailserverFrom, if already specified.
Mail server login
: String
The user name associated with the credentials.
The value will be taken from Setting_MailserverLogin, if already specified.
Mail server password
: String
The password for the user name associated with the credentials.
The value will be taken from Setting_MailserverPassword, if already specified.
Mail server ssl
: Boolean *
true
- ssl is enabled; false
- ssl is disabled. Read about
it here
The value will be taken from Setting_MailserverSsl, if already specified.
To
: String *
A string that contains the addresses of the recipients of the email message. Multiple email addresses must be separated with a comma character (",").
CC address list
: String[ ]
List of email addresses to carbon copy. The parameter value is stored as an escaped JSON string.
BCC address list
: String[ ]
List of email addresses to blind carbon copy. The parameter value is stored as an escaped JSON string.
Reply to address list
: String[ ]
List of email addresses to reply to. The parameter value is stored as an escaped JSON string.
Subject
: String
A string that contains the subject text.
Is HTML
: Boolean
true
- if the message body is in HTML; false
- if the message body is not HTML.
Body
: String
A string that contains the message body.
FillApproversUsers
Fills a list of approval users to be engaged in the approval process.
Parameters:
Users
String *
The list of users with a separator.
Example: User1, User2
Separator
String *
The separator to be used in the list of users.
Default value: comma
Get users from
: GetUsersFrom *
Defines the behavior for selecting a source to get the list of users.
Default value: FromParameters
Stage name
: String *
The name of the stage to get the list of users. To be sent to ApproversInStageAsync
FillApproversRoles
Fills the list of roles engaged in the approval process.
Available with subscription to the delegate UsersInRoleAsync.
Parameters:
Roles
: String *
The list of roles with a separator.
Separator
: String *
The separator to be used for the rules.
Default value: comma
ClearApprovers
Resets the approval flag for all members in the approval list, Approvers
parameter. Also sets the ActivityWithApprovers
parameter to null
.
Parameters:
None.
Conditions
Read about conditions.
CheckParameter
Compares the value of the parameter for the current or root process with the specified value.
Only string values are supported. For complex conditions, use conditions or expressions.
Parameters:
Parameter name
: String
The name of the parameter whose value is compared with the specified value.
Compare type
: CompareType *
CompareType defines the behavior when comparing the values.
Value
: String
One value or several values with a separator.
Separator
: String *
Only for In/NotIn type compare. The separator to be used for the list of values.
Default value: comma
For root process
: Boolean *
true
- the parameters will be obtained from the root process
; false
- the parameters will be obtained from the
current process.
Default value: false
Read about subprocesses.
CheckAllSubprocessesCompleted
Checks if all of the subprocesses created in the given process have been completed.
Parameters:
Mode
: Mode *
Mode defines the behavior for comparison.
IsProcessFinished
Checks if the process has been completed. If ProcessId is specified in the parameters, the process with this Id is checked. If not, the current process is checked.
Parameters:
Process id
: Guid *
The Id of the process to be checked for completion.
If not set, the id for current process will be used.
IsApprovedByUsers
Checks if the users with the specified IDs have already approved the document.
Parameters:
Users
: String *
A list of users with a separator.
Separator
: String *
The separator to be used in the list of users.
Default value: comma
IsApprovedByRoles
Checks if the users with the specified roles have already approved the document.
Available with subscription for the delegate UsersInRoleAsync.
Parameters:
Roles
: String *
A list of the roles with a separator.
Separator
: String *
The separator to be used in the list of roles.
Default value: comma
CheckHTTPRequest
Sends an HTTP(s) request to the specified URL and compares the response with the reference value.
Parameters:
Url
: String *
The Uri the request is sent to.
UserName
: String
The user name to be used in NetworkCredential when creating a request.
Password
: String
The password to be used in NetworkCredential when creating a request.
Post
: Boolean
true
- post request; false
- get request.
Store response
: Boolean
true
- the response will be stored in the parameter with the specified name, whose type
is temporary; false
- the response won't be stored in a variable.
Result field name
: String
The field in the response to be checked.
If not specified, the whole response will be checked.
Compare type
: compare type *
read about compare type.
Result field value
One value or several values with a separator.
Separator
: String *
Only for In/NotIn type compare. The separator between the values.
Default value: comma
Add process Id and scheme in parameters
: Boolean *
true
- process id will be added to the request parameters; false
- process id won't be added to the request
parameters.
Content type
: content type *
Only for post request. The response format.
Headers
A string that is a set of key-value pairs to be added to DefaultRequestHeaders for the given request.
Parameters
Only for post request. The request type parameters specified in content type.
IsApproveComplete
Checks if all of the necessary approvals have been received. See Parallel approval without branches
Rules
Read about rules.
CheckRole
Checks if the current user meets the role specified in the parameter.
Available from the interface of designer, with subscription for the delegate UsersInRoleAsync.
For the example, see here.
Used for FillApproversRoles, IsApprovedByRoles.
Approver
Checks if the current user is in the list specified by the FillApproversUsers action.
Predefined
Defines the PredefinedActors. I.e. it is the system Rule.
Elements
SetAfter
Value | Description |
---|---|
AfterAction | Execute after the action. The Actions specified after the current action won't be executed. |
AfterActivity | Execute after the activity. All of the actions specified in the activity will be executed, and only then, a transition will be performed. |
GetUsersFrom
Value | Description |
---|---|
FromParameters | Value to be received from the parameters specified in the form. |
FromApproversInStage | Value to be received from the delegate ApproversInStageAsync. |
ContentType
-
application/x-www-form-urlencoded
Form data is encoded as name/value pairs.
Example:
Name 1 = Value 1;
Name 2 = Value 2;
Name 3 = Value 3; -
application/json
Form data is encoded as json.
Example:
{
"Name 1": "Value 1",
"Name 2": "Value 2",
"Name 3": "Value 3"
}
CompareType
CompareType | Description & Examples |
---|---|
Equal(n, v) | n = y |
NotEqual(n, v) | n <> y |
Contains | "yummy" contains "umm" |
StartWith | "yummy" starts with "yu" |
EndWith | "yummy" ends with "my" |
NotContains | "yummy" does not contain "yy" |
StartAndEndWith | "yummy" starts and ends with "y" |
NotStartWith | "yummy" does not start with "my" |
NotEndWith | "yummy" ends with "yu" |
NotStartAndEndWith | "yummy" does not start or end with "mm" |
Greater(n, y) | n > y |
Less(n, y) | n < y |
GreaterOrEqual(n, y) | n >= y |
LessOrEqual(n, y) | n <= y |
In | 5 in (1, 2, 3, 4, 5) |
NotIn | 6 not in (1, 2, 3, 4, 5) |
Mode
Value | Description |
---|---|
AllSubprocesses | All the subprocesses. |
AllSubprocessesAndParent | All the subprocesses and parent. |