cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AKB_2K
Resolver I
Resolver 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

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
Pstork1
Dual Super User
Dual Super User

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.

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.

 

 

 

 

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,649)