How to automate approval from lookup table
Asked by Dewi _Andam D_ Maryuni_:

Hi masters,

I'm bumping to a requirement and hopefully all of you experts can help me.

Currently, I'm working on a form in JSD which contain an access request.

The flow is a user will submit a request for an access to -let's say- application A. to process the request, it needs 2 layers of approval, 1st: from user's direct manager, 2nd: from the application's owner. For the direct manager's approval, the requester can put the name himself (I use user picker). But for the application's owner approval, I want to apply an automation here. I have a list of mapping application to its owner and when the requester select the application that he needs to access, automatically the application's owner's name will be put as the 2nd approver (thus after the 1st approval, the owner will be able to see the approve button and approve it).

Hope you can enlighten me on how to work with this.

Thank you in advance,


Answers:
author: Ste Wright
body: Hi [@Dewi _Andam D_ Maryuni_](/t5/user/viewprofilepage/user-id/5398521)

Just to confirm the logic here...

* User submits a request
* User will submit their manager directly (manual)
* Once manager approves the access, the second approver is the app owner
* The app's owner should be assigned using Automation

...is this correct?

---

**Setup**

You can use a Lookup Table for this, but you'll need some metadata for it to refer to. I would recommend...

* A second Status for the app owner's approval - which will be the rule's trigger
* A field to capture the Application Name (I assume there is one)

And you will need...

* Each app owner's user ID - it's the long alphanumeric value in their user account URL.
* If the Application Name field is a select list, you might need each option's ID. You can find this by editing the custom field's values and hovering over each option's edit button. It's a 5-digit number at the end of the option's URL.

---

**Rule**

Rule might look something like this...

* **Trigger:** Issue Transitioned
  * To: *\<insert second approval status here\>*
* **Action:** Create lookup table
  * Table Name = secondApprover
  * Entries...
    * Row 1
      * Key = *\<application name or ID\>*
      * Value = *\<app owner's user ID\>*
    * Row 2
      * Key = *\<application name or ID\>*
      * Value = *\<app owner's user ID\>*
    * ...etc
* **Action:** Edit Issue
  * Field = Approvers
    * Value = *{{secondApprover.get(Application Name)}}*

---

**Notes**

A few notes on the rule, as it's just an example...

* Each table row needs two things...
  * Key - This is the value you're referring to, i.e the Application Name
  * Value - This is the value which will be set in Approvers, i.e the App Owner's user ID
* You should try name and ID for the Application Name field.
* You could edit any field - if you're not using the Approvers field for the second level
* The smart value in Edit Issue sets the approver based on the table - Application Name would be your field's name, but you can also use the custom field's ID if you want it to be more future-proofed - eg. customfield_10123

---

Give this a try and let us know how it goes.

If you need any more specific instructions on anything above, we'd be happy to provide those :)

Ste

comments: author: Dewi _Andam D_ Maryuni_
body: Thank you, [@Ste Wright](/t5/user/viewprofilepage/user-id/1166470) , I'm working on this now.

However, I bumped into another issue. See this form that I'm in the middle of working on shares the same workflow with other request type. However, the other request type will not use the same rule for the approval flow with this above problem. What do you suggest? Should I

1. create a whole new workflow for this? or
2. I can put the condition of using this specific request type form to apply the automation?

If it's the 2nd, how to do so?

I'm so sorry for the out-of-topic questions above.

I'm focusing right now about my original case of setting the approval using lookup table. And embarrassedly I need to admit that I'm stuck and need your detailed and step-by-step instruction as you offered in the bottom part of your original answer. Your effort of answering my question is hugely appreciated.

Again, thank you for your help