Saltar al contendio prinicipal

Setup an Approval Flow

Advertencia

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:

  1. 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.
  2. 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.
  3. 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.
  4. Then the client reviews the request and can accept, reject or appeal to the commercial area.
  5. The commercial area can approve, approve with condition or reject.
  6. 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 and web-admin-read to set up in the admin.

  • User with the access role read admin.

  • Create the following access role:

    Namepermission
    executiveexecutive
    commercialcommercial
    headexecutiveheadexecutive

User

Database

  • Create the state asset: a collection named Approval States with the following elements:
Name Code
0. Lifting of Requestliftingrequeststate
1. Pending by executive Headheadstate
2. Pending by Risk Committeeriskcomitteestate
3.a First proposalfirstproposalastate
3.b First proposalfirstproposalbstate
4. Accepted Requestsacceptedrequestsstate
5. Rejected Requestsrejectedrequestsstate
6. Pending Commercial Areacommercialstate
7. Second proposalsecondproposalbstate
  • 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 1product_1
Product 2product_2
Product 3product_3

GROUP

  • Create a group in the Workflow section with the following instruction:
    1. Name: Approval Manager
    2. Code: approvalmanager_1
    3. Set up the icon section as you like.
    4. 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:

    1. Survey named (AF) Banking Product Request, for the state 0:

      NameComponentSpecificationIdentifier
      Date of the RequestDate and TimeType: Date and Max/min: Disabledateapproval
      Client NameWritten AnswerType: Short Textnameclientapproval
      ProductMultiple choiceCollection type: Banking Productsproductapproval
      AmountMultiple choiceList 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 ScoreWritten AnswerType: numberscoreapproval
      AttachAttachmentAllow all file typeattachapproval
    2. Survey named (AF) Executive Head Validation, for state 1

      NameComponentSpecificationIdentifier
      Do you agree with the request?Type: Multiple ChoiceList 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
      CommentsWritten AnswerType: Long textcommentheadapproval
      AttachAttachmentAllow all file typeattachheadapproval
    3. Survey named (AF) Risk Committee Validation for state 2:

      NameComponentSpecificationIdentifier
      Do you agree with the request?Type: Multiple ChoiceList 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) NoThe id of the component is conditionriskapproval, for the first option is yes and for the second no
      CommentsWritten AnswerType: Long textcommentriskapproval
      Attach the emailAttachmentAllow all file typeattachriskapproval
    4. Survey named (AF) First Proposal a, for state 3.a:

      NameComponentSpecificationIdentifier
      Does the client agree with the proposal?Type: Multiple ChoiceList 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
      CommentsWritten AnswerType: Long textcommentfirstproposalaapproval
      Attach the emailAttachmentAllow all file typeattachfirstproposalaapproval
    5. Survey named (AF) First Proposal b, for state 3.b:

      NameComponentSpecificationIdentifier
      Does the client agree with the proposal?Type: Multiple ChoiceList 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
      CommentsWritten AnswerType: Long textcommentfirstproposalbapproval
      Attach the emailAttachmentAllow all file typeattachfirstproposalbapproval
    6. Survey named (AF) Commercial Area Validation, for state 6:

      NameComponentSpecificationIdentifier
      Do you agree with the request?Type: Multiple ChoiceList 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
      CommentsWritten AnswerType: Long textcommentcommercialapproval
      AttachAttachmentAllow all file typeattachcommercialapproval
    7. Survey named (AF) Second Proposal, for state 7:

      NameComponentSpecificationIdentifier
      Does the client agree with the second proposal?Type: Multiple ChoiceList of item type: (1) Agree and (2) DisagreeThe id of the component is secondproposalapproval, for the first option is agree and for the second disagree
      CommentsWritten AnswerType: Long textcommentsecondproposalapproval
      Attach the emailAttachmentAllow all file typeattachsecondproposalapproval

Steps

Workflow

  1. Access the administrator and open Workflow.

  2. Press the group Approval Manager.

  3. Press + button to create a new State Machine.

  4. Fill the following field:

    • Name: Approval Manager Flow
    • Code: approvalmanagerflow_1
    • Collection: Approval Asset
    • Element: Request
    • Additional Fields(1): Banking Products
    • States List: Approval States
  5. Save

  6. Re-enter the newly created Approval Manager Flow state machine for editing.

  7. Configure States section:

    • Firstable, you will create each of the states that the task could be.
    1. Create the following state:

      TypeElement
      NEW1. Pending by Executive Head
      IN-PROGRESS2. Pending by Risk Committee
      IN-PROGRESS3.a First proposal
      IN-PROGRESS3.b First proposal
      IN-PROGRESS6. Pending Commercial Area
      IN-PROGRESS7. Second proposal
      CLOSED4. Accepted Requests
      CLOSED5. Rejected Requests
    2. Initial State: 1. Pending by Executive Head

    • Secondly, you will relate each of the states and surveys.
    1. Configure the following state:

      1. Set up 1. Pending by Executive Head

        State ChangeCan Change
        2. Pending by Risk Committee*
        3.a First proposal*
        5. Rejected Requests*

        And add the survey trigger: (AF) Executive Head Validation

      2. Set up 2. Pending by Risk Committee

        State ChangeCan Change
        3.a First proposal*
        3.b First proposal*

        And add the survey trigger: (AF) Risk Committee Validation

      3. Set up 3.a First proposal

        State ChangeCan Change
        4. Accepted Requests*
        5. Rejected Requests*

        And add the survey trigger: (AF) First Proposal a

      4. Set up 3.b First proposal

        State ChangeCan Change
        4. Accepted Requests*
        5. Rejected Requests*

        And add the survey trigger: (AF) First Proposal b

      5. Set up 6. Pending Commercial Area

        State ChangeCan Change
        7. Second Proposal*
        5. Rejected Requests*

        And add the survey trigger: (AF) Commercial Area Validation

      6. Set up 7. Second Proposal

        State ChangeCan Change
        4. Accepted Requests*
        5. Rejected Requests*

        And add the survey trigger: (AF) Second Proposal

  8. Save

  9. Edit the Configuration of the workflow:

    • Flow Type: State-machine
    • Initial Workflow: Approval Manager
    • Hide closed task after: 100
    • Default view: Kanban View

Now we will configure the approval manager routine.

Bot

Firstable, we will start with the routine that initializes the workflow.

  1. Access the administrator and open Bot

  2. Press + button to create a new Bot.

  3. Set up general information, access and function section:

    • Name: Approval Manager Launcher
    • Code: approvalmanagerlauncherbot
    • User bot name: approvalmanagerlauncheruser
    • Access Roles: default
    • Active It's a survey command
    • Form: (AF) Banking Product Request
  4. Set up the routine builder:

CodeTypeSetting
get_usersNetwork RequestURL: $JOIN#/#($ENV#BASEURL)#api#v2#users#relations#boss#($VALUE#user)
Method: GET
header: {"admin":true}
Default authentication: Active
get_propertyNetwork RequestURL: $JOIN#/#($ENV#BASEURL)#(api)#(properties)#($VALUE#data|[find=>identifier=productapproval]|process|0)
Method: GET
Default authentication: Active
create_taskcreate taskItem 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_surveycopy messageMessages: $VALUE#messages
channel : $OUTPUT#create_task#task|channel
invite_bossEdit task usersCriteria: boss
Users: Active advanced mode and fill with $VALUE#user
Property: null
Group: group_id
Operation: eq
update_taskUpdate TaskTask: $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_acksend messageContent: 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_bosssend messageContent: $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_nacksend messageContent: 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.

  1. Create a new channel:
    • Name: Product Request Lift
    • Code: productrequestlift
    • Users: Miley Cyrus
    • Bots : Approval Manager Launcher
    • Add an Element:
      • Collection: Approval States
      • Element: liftingrequeststate
  2. 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.

  1. Access the administrator and open Workflow

  2. Press the group Approval Manager.

  3. Press the group Approval Manager Flow.

  4. Set up each one of the state:

    Remind

    Remember 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

    1. Press the state 1. Pending by Executive Head and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_boss*SwitchLeft 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_rejected
    case_approvedupdate task statetask: $VALUE#_id
    State: <id of 2.Pending by Risk Committee>
    Group: group_id
    Output by default: send_email
    case_rejectedupdate task statetask: $VALUE#_id
    State: <id of 5. Rejected Requests>
    Group: group_id
    Output by default: message_rejected
    message_approvedsend messageContent: 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#channel
    message_rejectedsend messageContent: Su solicitud fue rechazada por Jefatura.
    Type of Content:text/system
    Users: $VALUE#user
    Channel: Add an item and fill it with $VALUE#channel
    nwr_answersnetwork requestURL: $JOIN#/#($ENV#BASEURL)#api#v1#answers#uuid#($VALUE#answers|0)
    Method: GET
    header: {}
    Default authentication: Active
    Output by success: condition_amount
    send_emailsend emailSubject: 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_approved
    condition_amountConditionalLeft 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_product
    case_fast_approvedUpdate Task StateTask: $VALUE#_id
    State: <id of 3.a First proposal>
    Group: group_id
    Output by default: message_fast_approved
    message_fast_approvedsend messageContent: 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#channel
    nwr_property_productNetwork RequestURL: $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
    1. Press the state 2. Pending by Risk Committee and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_risk*switchLeft 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_condition
    message_approvedsend messageContent: 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#channel
    message_conditionsend messageContent: 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#channel
    message_approvedsend messageContent: 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#channel
    message_rejectedsend messageContent: 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#channel
    case_appeledUpdate Task StateTask: $VALUE#_id
    State: <id of 3.b First proposal>
    Group: group_id
    Output by default: validation_risk
    validation_appealedConditionalLeft Side: $VALUE#sentAnswer|data|[find=>identifier=conditionriskapproval]|process
    Right Side: yes
    Operator: eq
    Output condition true: case_appeled
    Output condition false: case_not_appeled
    case_not_appeledUpdate Task StateTask: $VALUE#_id
    State: <id of 3.a First proposal>
    Group: group_id
    Output by default: validation_risk
    1. Press the state 3.a First Proporsal and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_proporsal*ConditionalLeft Side: $VALUE#sentAnswer|data|[find=>identifier=firstproposalaapproval]|process
    Right Side: agree
    Operator: eq
    Output condition true: case_approved
    Output condition false: case_rejected
    case_approvedUpdate Task StateTask: $VALUE#_id
    State: <id of 4. Accepted Requests>
    Group: group_id
    Output by default: message_approved
    case_rejectedUpdate Task StateTask: $VALUE#_id
    State: <id of 5. Rejected Requests>
    Group: group_id
    Output by default: message_rejected
    message_rejectedsend messageContent: 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#channel
    message_approvedsend messageContent: 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
    1. Press the state 3.b First Proporsal and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_proposal*switchLeft 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_appealed
    case_approvedUpdate Task StateTask: $VALUE#_id
    State: <id of 4. Accepted Requests>
    Group: group_id
    Output by default: message_approved
    case_rejectedUpdate Task StateTask: $VALUE#_id
    State: <id of 5. Rejected Requests>
    Group: group_id
    Output by default: message_rejected
    case_appealedUpdate Task StateTask: $VALUE#_id
    State: <id of 6. Pending Commercial Area>
    Group: group_id
    Output by default: message_appealed
    message_approvedsend messageContent: 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_commercial
    invite_commercialEdit channel usersCriteria: null
    Users: Active advanced mode and fill with null
    Access Role: commercial
    Property: null
    Task: $VALUE#_id
    Group: group_id
    Operation: eq
    message_rejectedsend messageContent: 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#channel
    message_appealedsend messageContent: 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
    1. Press the state 6. Pending Commercial Area and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_commercial*switchLeft 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_condition
    message_approvedsend messageContent: 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_approved
    message_rejectedsend messageContent: 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_rejected
    message_conditionsend messageContent: 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_approved
    case_approvedUpdate Task StateTask: $VALUE#_id
    State: <id of 4. Second proposal>
    Group: group_id
    case_rejectedUpdate Task StateTask: $VALUE#_id
    State: <id of 5. Rejected Requests>
    Group: group_id
    1. Press the state 7. Second Proporsal and build the following routine in the survey trigger:
    CodeTypeSetting
    validation_proporsal*switchLeft 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_rejected
    case_approvedUpdate Task StateTask: $VALUE#_id
    State: <id of 4. Accepted Requests>
    Group: group_id
    Output by default: message_approved
    case_rejectedUpdate Task StateTask: $VALUE#_id
    State: <id of 5. Rejected Requests>
    Group: group_id
    Output by default: message_rejected
    message_rejectedsend messageContent: La propuesta fue rechazada por el cliente
    Type of Content:text/system
    Users: $VALUE#user
    Channel: Add an item and fill it with $VALUE#channel
    message_approvedsend messageContent: 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.

  1. Set the access role of the survey like follows:

    SurveyElementAccess RoleNote
    (AF) Banking Product Request0. Lifting of Requestexecutive
    (AF) Executive Head Validation1. Pending by executive Headheadexecutive
    (AF) Risk Committee Validation2. Pending by Risk Committeeexecutive
    (AF) First Proposal a3.a First proposalexecutiveThe executive will report the client's response through the platform.
    (AF) First Proposal b3.b First proposalexecutiveThe executive will report the client's response through the platform.
    (AF) Commercial Area Validation6. Pending Commercial Areacommercial
    (AF) Second Proposal7. Second proposalexecutive

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.

  1. Add a new SLA:

    • Name: Reminder Executive Head
    • Code: 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: Static
    • Time: HOURS|24
    • Routine:
    CodeTypeSetting
    emailsend emailSubject: 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.com
    task_request* Network RequestURL: $JOIN#/#($ENV#BASEURL)#api#tasks#($VALUE#taskGroupId)#task#($VALUE#taskId)
    Method: GET
    Active the button Default 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.