A8Flow
a8flow lists the pre-built functions available to you in A8Studio.
Functions
Here, let's take a look at these Functions.
dedupe
Performs duplication checks for instances for the provided input.
dedupe(request: DuplicateInstanceRequest): Promise<DuplicateInstanceResponse>
/* Checks for an instance associated with the Mobile Number "9876543210" and Name "superAdmin".
If found, it will return an array containing the corresponding "Details" and the OutVariable "aadhaarNo".
If not found, it will return an "Empty" array.*/
await a8flow.dedupe({
"variables": [
{
"name": "mobileNumber",
"value": "9876543210"
},
{
"name": "startedBy",
"value": "superAdmin"
}
],
"outVariables": ["aadhaarNo"]
});
evaluateDMN
Evaluates the rules of execution for a process.
evaluateDMN(key: string, data: any): Promise<any>
/* Executes a DMN named "tradin" with the specific "variable" values (typeofBusiness: "type - String",
and "value - params.app_Emp_Trader").*/
await a8flow.evaluateDMN('tradin',{
"variables": {
"typeofBusiness": {
"type": "String",
"value": params.app_Emp_Trader
}
}
});
eventLogger
A custom logger that lets you create a log for "Specific" events.
eventLogger(request: EventLoggerRequest): Promise<boolean>
/* Creates a log of the "Loan Application Status" for the user with corresponding UserID "0000000000" and
Mobile No "9876543210".*/
await a8flow.eventLogger({
userId: "0000000000",
eventName: "loanApplicationStatus",
properties: { "mobile": 9876543210 }
})
generateSequenceId
Generates "Sequential Values" for the App.
Note: On giving a "tag", it generates the SequenceID with respect to this tag. However, the "tag" is an optional parameter.
generateSequenceId(request: GenerateSeqIdRequest): Promise<GenerateSeqIdResponse>
// Generates a "Sequence ID" with respect to the "approval" tag.
await a8flow.generateSequenceId({
tag: "approval"
})
getGroupById
Returns details of the given GroupID.
getGroupById(groupId: string): Promise<groupResponse[]>
// Returns details of the "admin" GroupID.
await a8flow.getGroupById("admin");
getGroups
Returns a list of all the available Groups.
getGroups(): Promise<groupResponse[]>
// Returns a list of all the available groups.
await a8flow.getGroups();
getLoggedInUser
Returns the "Name" of the currently "Logged In" User.
getLoggedInUser(): Promise<getLoggedInUserResponse>
// Returns the name of the currently logged-in user.
await a8flow.getLoggedInUser()
getNextAvailableAgent
Lists the next available "agent" (user) in the group with access to the process based on the provided algorithm (roundRobin or mostIdleAgent).
Note:
roundRobin
- schedules the process in a circular order with no priority to any user-specifics in the group.mostIdleAgent
- schedules the process based on the "mostIdle" user in the group. Optional: You also have a "tag", an optional parameter.
getNextAvailableAgent(req: IntelligentRouteRequest): Promise<IntelligentRouteResponse>
/* Lists the next available user in the group "admin" with access to the process with the "processMigration"
definitioKey.
And the roundRobin algorithm schedules the process in a circular order to the users with the "approver" tag.*/
await a8flow.getNextAvailableAgent({
groupId: "admin",
processDefinitionKey: "processMigration",
algorithm: "roundRobin",
tag: "approver",
});
getProcessDefinitions
Returns a list of the latest process definitions.
getProcessDefinitions(): Promise<processDefinitionResponse[]>
// Returns a list of the latest process definitions.
await a8flow.getProcessDefinitions();
getUserById
Returns details of the given UserID.
getUserById(userId: string): Promise<userResponse[]>
// Returns the user details of "john_johnson".
await a8flow.getUserById("john_johnson");
getUsers
Returns a list of all the available "Users".
getUsers(): Promise<userResponse[]>
// Returns a list of all the available users.
await a8flow.getUsers();
getUserByGroupId
Returns the "User-List" for the given GroupID.
getUserByGroupId(groupId: string): Promise<userResponse[]>
// Returns the list of users for the "admin" GroupID.
await a8flow.getUsersByGroupId("admin");
sendMessage
Correlates a message to the "process engine" to either trigger a message start event or an intermediate message catching event. Message events reference a named message, and a message has a name and a payload. Unlike a signal, a message event is always directed at a single recipient.
sendMessage(request: SendMessageRequest): Promise<boolean>
/* Helps trigger a message event named "New_Applicant_Verification" along with the processVariables
(john_johnson) needed for the event.*/
await a8flow.sendMessage({
messageName: "New_Applicant_Verification",
processVariables: {name:"john_johnson"}
});
setDueDateAndFollowUpDate
Sets the delivery and follow-up dates for a particular task.
setDueDateAndFollowUpDate(request: setDueDateAndFollowUpDateRequest): Promise<any>
// Sets the Delivery Date as "2022-01-01" and Follow-Up Date as "2022-01-31".
await a8flow.setDueDateAndFollowUpDate( {
due: "2022-01-01T00:00:00.000+0000",
followUp: "2022-01-31T00:00:00.000+0000"
});
startNewProcessInstance
Starts a new process instance for the given "process definition key".
Note: Variables field is optional. If supplied, the instance will start with the provided variables; else, without it.
startNewProcessInstance(request: startNewProcessInstanceRequest): Promise<startNewProcessInstanceResponse>
/* Starts a new process instance for the given "process definition key" (Loan_Approval) with the provided
variable values ("FirstName: deepika", & "Age: 23").*/
await a8flow.startNewProcessInstance({
procDefKey: "Loan_Approval",
variables: {
FirstName: { "value": "deepika" },
age: { "value": 23 },
}
});