Skip to main content

A8Flow

a8flow lists the pre-built functions available to you in A8Studio.


Functions

Here, let's take a look at these Functions.

a8flow


dedupe

Performs duplication checks for instances for the provided input.

Method:
dedupe(request: DuplicateInstanceRequest): Promise<DuplicateInstanceResponse>
Usage:
/* 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.

Method:
evaluateDMN(key: string, data: any): Promise<any>
Usage:
/* 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.

Method:
eventLogger(request: EventLoggerRequest): Promise<boolean>
Usage:
/* 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.

Method:
generateSequenceId(request: GenerateSeqIdRequest): Promise<GenerateSeqIdResponse>
Usage:
// Generates a "Sequence ID" with respect to the "approval" tag.

await a8flow.generateSequenceId({
tag: "approval"
})

getGroupById

Returns details of the given GroupID.

Method:
getGroupById(groupId: string): Promise<groupResponse[]>
Usage:
// Returns details of the "admin" GroupID.

await a8flow.getGroupById("admin");

getGroups

Returns a list of all the available Groups.

Method:
getGroups(): Promise<groupResponse[]>
Usage:
// Returns a list of all the available groups.

await a8flow.getGroups();

getLoggedInUser

Returns the "Name" of the currently "Logged In" User.

Method:
getLoggedInUser(): Promise<getLoggedInUserResponse>
Usage:
// 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.

Method:
getNextAvailableAgent(req: IntelligentRouteRequest): Promise<IntelligentRouteResponse>
Usage:
/* 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.

Method:
getProcessDefinitions(): Promise<processDefinitionResponse[]>
Usage:
// Returns a list of the latest process definitions.

await a8flow.getProcessDefinitions();

getUserById

Returns details of the given UserID.

Method:
getUserById(userId: string): Promise<userResponse[]>
Usage:
// Returns the user details of "john_johnson".

await a8flow.getUserById("john_johnson");

getUsers

Returns a list of all the available "Users".

Method:
getUsers(): Promise<userResponse[]>
Usage:
// Returns a list of all the available users.

await a8flow.getUsers();

getUserByGroupId

Returns the "User-List" for the given GroupID.

Method:
getUserByGroupId(groupId: string): Promise<userResponse[]>
Usage:
// 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.

Method:
sendMessage(request: SendMessageRequest): Promise<boolean>
Usage:
/* 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.

Method:
setDueDateAndFollowUpDate(request: setDueDateAndFollowUpDateRequest): Promise<any>
Usage:
// 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.

Method:
startNewProcessInstance(request: startNewProcessInstanceRequest): Promise<startNewProcessInstanceResponse>
Usage:
/* 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 },
}
});