cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Getting JSON key for approval flow

Hello All,

 

I am using flow to Trigger Approval Flow when any new item is added to enhancement list through my PowerApps application. Now this approval trigger is "Custom Response - Wait for the response" type and it is being sent out to Multiple approvers. In SharePoint list I have created a column to store the approver email or name and comments. 

 

To capture the name and comments field, I have created 2 string variables which I initialized at start of flow. 

 

I have written following JSON to capture email but it is giving me blank value. Any reason why?

{
    "type": "object",
    "properties": {
        "email": {
            "type": "string"
        }
    }
}

 

This is the JSON content

{
  "responder": {
    "id": "603",
    "displayName": "LastName, FirstName",
    "email": "FirstName.LastName@test.com",
    "tenantId": "e2d",
    "userPrincipalName": "FirstName.LastName@test.com"
  },
  "requestDate": "2019-12-23T15:42:06Z",
  "responseDate": "2019-12-23T15:43:11Z",
  "approverResponse": "Approved",
  "comments": "YES"
}

 

Comment is being captured properly using similar JSON.

{
    "type": "object",
    "properties": {
        "comments": {
            "type": "string"
        }
    }
}

 

By the way, capturing of the email/comments is encapsulated in a "Apply to each" on "Responses" which is performing following 2 functions.

  • Parse JSON (code mentioned above)
  • Append to String variable

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Getting JSON key for approval flow

l will check your suggestion too but I require name to dynamically captured via flow and it has to be a seperate string not merged with comments.  

 

What I did now which is working for me is using the "generate from sample" feature provided in flow in Parse JSON. Using that I picked up the userPrincipalName to append the data to my string.

 

 

 

 

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User
Dual Super User

Re: Getting JSON key for approval flow

Why write custom JSON to capture values that are already present in the Apply to each loop as dynamic data?  Here's a screenshot of an approval Flow I built to do exactly what you are suggesting.  

screenshot.png

In my case I am appending the responder's display name and comments to a single string variable that I later add to a field in the metadata of the document being approved.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Helper I
Helper I

Re: Getting JSON key for approval flow

l will check your suggestion too but I require name to dynamically captured via flow and it has to be a seperate string not merged with comments.  

 

What I did now which is working for me is using the "generate from sample" feature provided in flow in Parse JSON. Using that I picked up the userPrincipalName to append the data to my string.

 

 

 

 

View solution in original post

Highlighted
Dual Super User
Dual Super User

Re: Getting JSON key for approval flow

You can easily capture the name and comments separately if you just initialize two variables.  I do them as one variable so that I can keep the name associated with the specific comments when they wordwrap because they are too long.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,622)