Setup an Approval Flow
Esta página aún no se encuentra traducida al español.
Time to complete: 120 minutes.
Company Requests
Ruanda wants to implement another project: the Approval flow for a product requested by a client. The actual problem is that they need a easy way to handle the requests, because for the moment all is by paper and it could be much easier and quick. This solution will agilize the approval papers of the company, reducing time.
The company explains the following flow:
- An executive raises a product request from a client. They upload the information to their database and, in return, give a score to the customer.
- The request goes up to the chief executive. If it is below a certain amount, you can approve it directly, otherwise it must be evaluated by the risk department.
- Risk can approve, reject and conditionally reject the request. They also decide if the client applies the condition of appeal to the commercial area, which analyzes the case with other factors in addition to the score.
- Then the client reviews the request and can accept, reject or appeal to the commercial area.
- The commercial area can approve, approve with condition or reject.
- Finally, the client can check the purpose of the commercial area, being able to accept or reject it.
Funtional Requirements
Access Role
User with the permission
admin-*-write
, which allows all above.User with the permissions
web-admin-write
andweb-admin-read
to set up in the admin.User with the access role
read admin
.Create the following access role:
Name permission executive executive commercial commercial headexecutive headexecutive
User
Create the following employees:
Name Lastname email Job Title Access Role Miley Cyrus miley@ruanda.com executive executive Mon Laferte mon@ruanda.com head of risk control Sam Smith sam@ruanda.com risk analyst Jorge Drexler jorge@ruanda.com commercial commercial Diego Lorenzini diego@ruanda.com head executive headexecutive
Database
- Create the state asset: a collection named Approval States with the following elements:
Name | Code |
---|---|
0. Lifting of Request | liftingrequeststate |
1. Pending by executive Head | headstate |
2. Pending by Risk Committee | riskcomitteestate |
3.a First proposal | firstproposalastate |
3.b First proposal | firstproposalbstate |
4. Accepted Requests | acceptedrequestsstate |
5. Rejected Requests | rejectedrequestsstate |
6. Pending Commercial Area | commercialstate |
7. Second proposal | secondproposalbstate |
Create the asset of the task: a collection named Approval Asset with the element named Request
Create the collection of the banking producto named Banking Products with the following generic elements:
Name | Code |
---|---|
Product 1 | product_1 |
Product 2 | product_2 |
Product 3 | product_3 |
GROUP
- Create a group in the Workflow section with the following instruction:
Name
: Approval ManagerCode
: approvalmanager_1- Set up the icon section as you like.
- Active
Allow channel creation
Save the group id. With the group_id tag we will refer to it.
SURVEY
Create the following Survey for each of the state. They must to be assocated to the created group Approval Manager:
Survey named (AF) Banking Product Request, for the state 0:
Name Component Specification Identifier Date of the Request Date and Time Type: Date and Max/min: Disable dateapproval Client Name Written Answer Type: Short Text nameclientapproval Product Multiple choice Collection type: Banking Products productapproval Amount Multiple choice List of item type: (1) More than $$ or (2) Less than or equal to $$. The id of the component is amountapproval, for the first option is more and for the other less Client Score Written Answer Type: number scoreapproval Attach Attachment Allow all file type attachapproval Survey named (AF) Executive Head Validation, for state 1
Name Component Specification Identifier Do you agree with the request? Type: Multiple Choice List of item type: (1) Agree (2) Disagree. The id of the component is headapproval, for the first option is agree and for the other disagree Comments Written Answer Type: Long text commentheadapproval Attach Attachment Allow all file type attachheadapproval Survey named (AF) Risk Committee Validation for state 2:
Name Component Specification Identifier Do you agree with the request? Type: Multiple Choice List of item type: (1) Agree, (2) Agree with Condition and (3) Disagree. The id of the component is riskapproval, for the first option is agree, for the second condition and for the other disagree Does the client meet the conditions? List of item type: (1) Yes and (2) No The id of the component is conditionriskapproval, for the first option is yes and for the second no Comments Written Answer Type: Long text commentriskapproval Attach the email Attachment Allow all file type attachriskapproval Survey named (AF) First Proposal a, for state 3.a:
Name Component Specification Identifier Does the client agree with the proposal? Type: Multiple Choice List of item type: (1) Agree (2) Disagree. The id of the component is firstproposalaapproval, for the first option is agree and for the other disagree Comments Written Answer Type: Long text commentfirstproposalaapproval Attach the email Attachment Allow all file type attachfirstproposalaapproval Survey named (AF) First Proposal b, for state 3.b:
Name Component Specification Identifier Does the client agree with the proposal? Type: Multiple Choice List of item type: (1) Agree, (2) Disagree and (3)Commercial Area Appeal. The id of the component is firstproposalbapproval, for the first option is agree, for the second disagree and for the third appeal Comments Written Answer Type: Long text commentfirstproposalbapproval Attach the email Attachment Allow all file type attachfirstproposalbapproval Survey named (AF) Commercial Area Validation, for state 6:
Name Component Specification Identifier Do you agree with the request? Type: Multiple Choice List of item type: (1) Agree, (2) Disagree and (3) Agree with Condition. The id of the component is commercialapproval, for the first option is agree, for the second disagree and for the third condition Comments Written Answer Type: Long text commentcommercialapproval Attach Attachment Allow all file type attachcommercialapproval Survey named (AF) Second Proposal, for state 7:
Name Component Specification Identifier Does the client agree with the second proposal? Type: Multiple Choice List of item type: (1) Agree and (2) Disagree The id of the component is secondproposalapproval, for the first option is agree and for the second disagree Comments Written Answer Type: Long text commentsecondproposalapproval Attach the email Attachment Allow all file type attachsecondproposalapproval
Steps
Workflow
Access the
administrator
and openWorkflow
.Press the group Approval Manager.
Press
+
button to create a new State Machine.Fill the following field:
Name
: Approval Manager FlowCode
: approvalmanagerflow_1Collection
: Approval AssetElement
: RequestAdditional Fields
(1): Banking ProductsStates List
: Approval States
Save
Re-enter the newly created Approval Manager Flow state machine for editing.
Configure States section:
- Firstable, you will create each of the states that the task could be.
Create the following state:
Type Element NEW 1. Pending by Executive Head IN-PROGRESS 2. Pending by Risk Committee IN-PROGRESS 3.a First proposal IN-PROGRESS 3.b First proposal IN-PROGRESS 6. Pending Commercial Area IN-PROGRESS 7. Second proposal CLOSED 4. Accepted Requests CLOSED 5. Rejected Requests Initial State
: 1. Pending by Executive Head
- Secondly, you will relate each of the states and surveys.
Configure the following state:
Set up 1. Pending by Executive Head
State Change Can Change 2. Pending by Risk Committee * 3.a First proposal * 5. Rejected Requests * And add the survey trigger: (AF) Executive Head Validation
Set up 2. Pending by Risk Committee
State Change Can Change 3.a First proposal * 3.b First proposal * And add the survey trigger: (AF) Risk Committee Validation
Set up 3.a First proposal
State Change Can Change 4. Accepted Requests * 5. Rejected Requests * And add the survey trigger: (AF) First Proposal a
Set up 3.b First proposal
State Change Can Change 4. Accepted Requests * 5. Rejected Requests * And add the survey trigger: (AF) First Proposal b
Set up 6. Pending Commercial Area
State Change Can Change 7. Second Proposal * 5. Rejected Requests * And add the survey trigger: (AF) Commercial Area Validation
Set up 7. Second Proposal
State Change Can Change 4. Accepted Requests * 5. Rejected Requests * And add the survey trigger: (AF) Second Proposal
Save
Edit the Configuration of the workflow:
Flow Type
: State-machineInitial Workflow
: Approval ManagerHide closed task after
: 100Default view
: Kanban View
Now we will configure the approval manager routine.
Bot
Firstable, we will start with the routine that initializes the workflow.
Access the
administrator
and openBot
Press
+
button to create a new Bot.Set up general information, access and function section:
Name
: Approval Manager LauncherCode
: approvalmanagerlauncherbotUser bot name
: approvalmanagerlauncheruserAccess Roles
: default- Active
It's a survey command
Form
: (AF) Banking Product Request
Set up the routine builder:
Code | Type | Setting |
---|---|---|
get_users | Network Request | URL : $JOIN#/#($ENV#BASEURL)#api#v2#users#relations#boss#($VALUE#user) Method : GET header : {"admin":true} Default authentication : Active |
get_property | Network Request | URL : $JOIN#/#($ENV#BASEURL)#(api)#(properties)#($VALUE#data|[find=>identifier=productapproval]|process|0)Method : GET Default authentication : Active |
create_task | create task | Item of the Name : $JOIN# - #(Solicitud )#($OUTPUT#get_property#data|name|display)#($VALUE#data|[find=>identifier=dateapproval]|process|0|[date=>format=DD-MM-YYYY]) Group : group_id User : $VALUE#user Dynamic Field 1 : $VALUE#data|[find=>identifier=productapproval]|process|0 |
copy_survey | copy message | Messages : $VALUE#messages channel : $OUTPUT#create_task#task|channel |
invite_boss | Edit task users | Criteria : boss Users : Active advanced mode and fill with $VALUE#user Property : null Group : group_id Operation : eq |
update_task | Update Task | Task : $OUTPUT#create_task#task|_id Group : group_id Active the task Name : $JOIN# - #($OUTPUT#create_task#task|serial)#(Solicitud )#($OUTPUT#get_property#data|name|display)#($VALUE#data|[find=>identifier=dateapproval]|process|0|[date=>format=DD-MM-YYYY]) |
send_ack | send message | Content : Tu solicitud se ha ingresado correctamente, ahora debes esperar la revisión por jefatura de la sucursal. Type of Content :text/system Users : $VALUE#user Channel : Active Advanced mode and fill $VALUE#channel |
message_add_boss | send message | Content : $JOIN# #(Se ha añadido)#($OUTPUT#get_user#data|data|users|0|name|names)#($OUTPUT#get_user#data|data|users|0|name|lastName) Type of Content :text/system Users : $VALUE#user Channel : Add an item and fill it with $OUTPUT#create_task#task|channel |
send_nack | send message | Content : No se ha podido crear tu solicitud. Type of Content :text/system Users : $VALUE#user Channel : Active Advanced mode and fill $VALUE#channel |
And now it only remains to relate each of the stages. The idea is to follow the following image:


Channel
Now we have to relate the bot to the channel, to use it.
- Create a new channel:
Name
: Product Request LiftCode
: productrequestliftUsers
: Miley CyrusBots
: Approval Manager Launcher- Add an Element:
Collection
: Approval StatesElement
: liftingrequeststate
- Save
Workflow Routine
If you stop the tutorial at this point, you can manage approval from the task view, but the idea is to use the surveys. So it's time to set up the routines of the states triggered by a form.
Access the
administrator
and openWorkflow
Press the group Approval Manager.
Press the group Approval Manager Flow.
Set up each one of the state:
RemindRemember to save the routine, the state, and the state machine, once you finish configuring.
The stage marked with an *, means that it is the initial stage- Press the state 1. Pending by Executive Head and build the following routine in the survey trigger:
Code Type Setting validation_boss* Switch Left side
: $VALUE#sentAnswer|data|[find=>identifier=headapproval]|process|0
Right side A
: agree
Right side B
: disagree
Right side C
: null
Right side D
: null
Right side E
: null
Operator
: eq
Case A
: nwr_answers
Case B
: case_rejectedcase_approved update task state task
: $VALUE#_id
State
: <id of 2.Pending by Risk Committee>
Group
: group_id
Output by default
: send_emailcase_rejected update task state task
: $VALUE#_id
State
: <id of 5. Rejected Requests>
Group
: group_id
Output by default
: message_rejectedmessage_approved send message Content
: Su solicitud fue aceptada por Jefatura. Dado que supera el monto $$, se le envió mail al Comité de Riesgo y ahora debes esperar su aprobación.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_rejected send message Content
: Su solicitud fue rechazada por Jefatura.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelnwr_answers network request URL
: $JOIN#/#($ENV#BASEURL)#api#v1#answers#uuid#($VALUE#answers|0)
Method
: GET
header
: {}
Default authentication
: Active
Output by success
: condition_amountsend_email send email Subject
: Se ha solicitado un nuevo producto bancario
Data
: {"recipientName":"Comité de Riesgo","recipientEmail":"Comité de Riesgo","companyName":"tratton","title":["Se ha solicitado un nuevo producto bancario"],"action":"","code":"","messageA":"$JOIN##(Se le solicita que se revise el caso de )#($OUTPUT#nwranswers#data|data|[find=>identifier=nameclientapproval]|process|0)#(, que solicitó )#($OUTPUT#nwr_property_producto#data|name|display)#( a un monto de )#($OUTPUT#nwr_answers#data|data|[find=>identifier=amountapproval]|[cotanswer_list=>array]|[toString=>])#( y bajo sus condiciones obtuvo el siguiente puntaje )#($OUTPUT#nwr_answers#data|data|[find=>identifier=scoreapproval]|process|0)","messageB":"$JOIN##(La solicitud fue levantada en la fecha: )#($OUTPUT#nwr_answers#data|data|[find=>identifier=dateapproval]|process|0|[date=>format=DD-MM-YYYY])#(. Muchas gracias de antemano.)"}
Attachment
: $OUTPUT#nwr_answers#data|data|[find=>identifier=attachapproval]|process|0
To
: add two items and fill them with mon@ruanda.com and sam@ruanda.com
Output by default
: message_approvedcondition_amount Conditional Left Side
: $OUTPUT#nwr_answers#data|data|[find=>identifier=amountapproval]|process|0 |
Right Side
: more
Operator
: eq
Output condition true
: case_fast_approved
Output condition false
: nwr_property_productcase_fast_approved Update Task State Task
: $VALUE#_id
State
: <id of 3.a First proposal>
Group
: group_id
Output by default
: message_fast_approvedmessage_fast_approved send message Content
: Su solicitud fue aprobada por Jefatura. Dado que era de un monto menor a $$, ahora solo debe presentar la primera propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelnwr_property_product Network Request URL
: $JOIN#/#($ENV#BASEURL)#api#v1#properties#($OUTPUT#nwr_answers#data|data|[find=>identifier=prdct]|process|0)
Method
: GET
header
: {}
Default authentication
: Active
Output by success
: case_approved- Press the state 2. Pending by Risk Committee and build the following routine in the survey trigger:
Code Type Setting validation_risk* switch Left side
: $VALUE#sentAnswer|data|[find=>identifier=riskapproval]|process
Right side A
: agree
Right side B
: disagree
Right side C
: condition
Right side D
: null
Right side E
: null
Operator
: eq
Case A
: massage_approved
Case B
: message_rejected
Case C
: message_conditionmessage_approved send message Content
: Su solicitud fue aceptada por riesgo, se puede presentar la primera propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_condition send message Content
: Su solicitud fue aceptada con condiciones por riesgo, se puede presentar la primera propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_approved send message Content
: Su solicitud fue aceptada por riesgo, se puede presentar la primera propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_rejected send message Content
: Su solicitud fue rechazada por riesgo, debe conversar con el cliente para los siguientes pasos.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelcase_appeled Update Task State Task
: $VALUE#_id
State
: <id of 3.b First proposal>
Group
: group_id
Output by default
: validation_riskvalidation_appealed Conditional Left Side
: $VALUE#sentAnswer|data|[find=>identifier=conditionriskapproval]|process
Right Side
: yes
Operator
: eq
Output condition true
: case_appeled
Output condition false
: case_not_appeledcase_not_appeled Update Task State Task
: $VALUE#_id
State
: <id of 3.a First proposal>
Group
: group_id
Output by default
: validation_risk- Press the state 3.a First Proporsal and build the following routine in the survey trigger:
Code Type Setting validation_proporsal* Conditional Left Side
: $VALUE#sentAnswer|data|[find=>identifier=firstproposalaapproval]|process
Right Side
: agree
Operator
: eq
Output condition true
: case_approved
Output condition false
: case_rejectedcase_approved Update Task State Task
: $VALUE#_id
State
: <id of 4. Accepted Requests>
Group
: group_id
Output by default
: message_approvedcase_rejected Update Task State Task
: $VALUE#_id
State
: <id of 5. Rejected Requests>
Group
: group_id
Output by default
: message_rejectedmessage_rejected send message Content
: La primera propuesta fue rechazada por el cliente
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_approved send message Content
: La primera propuesta fue aceptada por el cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel- Press the state 3.b First Proporsal and build the following routine in the survey trigger:
Code Type Setting validation_proposal* switch Left side
: $VALUE#sentAnswer|data|[find=>identifier=firstproposalbapproval]|process
Right side A
: agree
Right side B
: disagree
Right side C
: appeal
Right side D
: null
Right side E
: null
Operator
: eq
Case A
: case_approved
Case B
: case_rejected
Case C
: case_appealedcase_approved Update Task State Task
: $VALUE#_id
State
: <id of 4. Accepted Requests>
Group
: group_id
Output by default
: message_approvedcase_rejected Update Task State Task
: $VALUE#_id
State
: <id of 5. Rejected Requests>
Group
: group_id
Output by default
: message_rejectedcase_appealed Update Task State Task
: $VALUE#_id
State
: <id of 6. Pending Commercial Area>
Group
: group_id
Output by default
: message_appealedmessage_approved send message Content
: La primera propuesta fue aceptada por el cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel
Output
: invite_commercialinvite_commercial Edit channel users Criteria
: null
Users
: Active advanced mode and fill with null
Access Role
: commercial
Property
: null
Task
: $VALUE#_id
Group
: group_id
Operation
: eqmessage_rejected send message Content
: La primera propuesta fue rechazada por el cliente
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_appealed send message Content
: Su Solicitud está en proceso de revisión por el Área Comercial.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel- Press the state 6. Pending Commercial Area and build the following routine in the survey trigger:
Code Type Setting validation_commercial* switch Left side
: $VALUE#sentAnswer|data|[find=>identifier=commercialapproval]|process
Right side A
: agree
Right side B
: disagree
Right side C
: condition
Right side D
: null
Right side E
: null
Operator
: eq
Case A
: message_approved
Case B
: message_rejected
Case C
: message_conditionmessage_approved send message Content
: Su solicitud fue aprobada por el área comercial, ahora deberás presentarle la segunda propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel
Output
: case_approvedmessage_rejected send message Content
: Su solicitud fue rechazada por área comercial.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel
Output
: case_rejectedmessage_condition send message Content
: Su solicitud fue aprobada con condiciones por área comercial, ahora deberás presentarle la segunda propuesta al cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel
Output
: case_approvedcase_approved Update Task State Task
: $VALUE#_id
State
: <id of 4. Second proposal>
Group
: group_idcase_rejected Update Task State Task
: $VALUE#_id
State
: <id of 5. Rejected Requests>
Group
: group_id- Press the state 7. Second Proporsal and build the following routine in the survey trigger:
Code Type Setting validation_proporsal* switch Left side
: $VALUE#sentAnswer|data|[find=>identifier=secondproposalapproval]|process
Right side A
: agree
Right side B
: disagree
Right side C
: null
Right side D
: null
Right side E
: null
Operator
: eq
Case A
: case_approved
Case B
: case_rejectedcase_approved Update Task State Task
: $VALUE#_id
State
: <id of 4. Accepted Requests>
Group
: group_id
Output by default
: message_approvedcase_rejected Update Task State Task
: $VALUE#_id
State
: <id of 5. Rejected Requests>
Group
: group_id
Output by default
: message_rejectedmessage_rejected send message Content
: La propuesta fue rechazada por el cliente
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channelmessage_approved send message Content
: La propuesta fue aceptada por el cliente.
Type of Content
:text/system
Users
: $VALUE#user
Channel
: Add an item and fill it with $VALUE#channel
Survey
Now we must allow only authorized people to answer the survey and relate the corresponding element of the collection Approval States to view the survey in the corresponding channel.
Set the access role of the survey like follows:
Survey Element Access Role Note (AF) Banking Product Request 0. Lifting of Request executive (AF) Executive Head Validation 1. Pending by executive Head headexecutive (AF) Risk Committee Validation 2. Pending by Risk Committee executive (AF) First Proposal a 3.a First proposal executive The executive will report the client's response through the platform. (AF) First Proposal b 3.b First proposal executive The executive will report the client's response through the platform. (AF) Commercial Area Validation 6. Pending Commercial Area commercial (AF) Second Proposal 7. Second proposal executive
SLA
At the moment we have the process configured, it remains to add the reminder, which is executed when the Executive Head does not respond in 24 hours.
Add a new SLA:
Name
: Reminder Executive HeadCode
: reminderexecutivehead- In Start:
States
: 1. Pending by executive Head
- In End:
States
: 2. Pending by Risk Committee, 3.a First proposal and 5. Rejected Requests
Time Type
: StaticTime
: HOURS|24- Routine:
Code Type Setting email send email Subject
: Recordatorio: Responder Solicitudes de Producto Pendiente
Data
: {"recipientName":"Jefe Ejecutivo","recipientEmail":"Jefe Ejecutivo","companyName":"Ruanda","title":["Estamos esperando tu respuesta"],"action":"","code":"","messageA":"$JOIN##(La Solicitud levantada con el nombre )#($OUTPUT#task_request#data|name)#( no tiene respuesta aún)","messageB":""}
To
: add an item and fill it with diego@ruanda.comtask_request* Network Request URL
: $JOIN#/#($ENV#BASEURL)#api#tasks#($VALUE#taskGroupId)#task#($VALUE#taskId)
Method
: GET
Active the buttonDefault authentication
Success
: email
Results
As a guide, the image shown is the same workflow but with the names in Spanish:

And the state machine follows the following proccess:

The pictures will be updated soon.