Hello Proffessionals!
I made a functioning Approval Flow using Power Automate, but when trying to parse a json i get following error.
So my goal is to attach the Links from the forms attachments and only having the Link in the approval Flow, thats why i'm trying to implement the json step.
The error says that it'S not possible to have nested for each loops. How can I add the Json step withouth getting this error?
Solved! Go to Solution.
Hello @KevZF ,
in order to avoid the first apply to each to get the attachments links, please follow these steps:
1. Initialize an Array variable:
2. Get response details from the Trigger:
3. Add a "Compose" action in which put the following expression:
json(outputs('Get_response_details')?['body/rb8620b6b2c4e4eb181de495f2886511e'])
Instead of "rb8620b6b2c4e4eb181de495f2886511e", please specify your attachment question.
4. Add an "Apply to each" control from the previous Compose outputs and within add an "Append to array variable" action, putting the following expression:
item()?['link']
5. Outside from the apply to each, you can check how is filled you variable by adding a Compose action:
join(variables('varDocUrl'),',')
Here my output:
So, you can put the variable in the "Item link" field within the "Start and wait for an approval" action.
Otherwise, and I suggest the following solution, it should be preferrable to attach the docs to the Approval email:
https://www.bythedevs.com/post/working-with-files-on-ms-forms-in-ms-power-automate
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
Hello @KevZF ,
in order to avoid the first apply to each to get the attachments links, please follow these steps:
1. Initialize an Array variable:
2. Get response details from the Trigger:
3. Add a "Compose" action in which put the following expression:
json(outputs('Get_response_details')?['body/rb8620b6b2c4e4eb181de495f2886511e'])
Instead of "rb8620b6b2c4e4eb181de495f2886511e", please specify your attachment question.
4. Add an "Apply to each" control from the previous Compose outputs and within add an "Append to array variable" action, putting the following expression:
item()?['link']
5. Outside from the apply to each, you can check how is filled you variable by adding a Compose action:
join(variables('varDocUrl'),',')
Here my output:
So, you can put the variable in the "Item link" field within the "Start and wait for an approval" action.
Otherwise, and I suggest the following solution, it should be preferrable to attach the docs to the Approval email:
https://www.bythedevs.com/post/working-with-files-on-ms-forms-in-ms-power-automate
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
Hello Marco,
thank you so much for the answer!
When I try to add the "2. Get response details from the Trigger:",
power automate automatically adds another "apply to each" loop.
Should I add the steps after that to that loop?
Kind regards
Kev
Hello @KevZF ,
PA should not automatically create an Apply to each loop. Have you simply added the Response ID like below?
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
Hey Marco,
today it worked without PA putting in the apply each loop.
I tried replicating your solution but somehow i still get following error :
my Flow looks like this :
the only thing I see that is different to your Flow, is the Value in the append to array variable.
I copied what you put into there but somehow the step doesn't recognize the link?
Kind regards
Kev
Hello @KevZF ,
in the "Append to array" action, you should put "item()?['link']" as expression, not as free text.
If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
This worked out, thanks!
somehow I still get an error...
Kind regards
Kev
Hello @KevZF ,
in the Compose action you should put this expression as an expression, not as free text:
json(outputs('Get_response_details')?['body/rb8620b6b2c4e4eb181de495f2886511e'])
If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
Hey Marco,
thanks for the quick replys and sorry for the inconvenience, but I can't seem to make it work! 😞
I did put this in as a expression :
json(outputs('Get_response_details')?['body/rb8620b6b2c4e4eb181de495f2886511e'])
Hello @KevZF ,
you've to replace "rb8620b6b2c4e4eb181de495f2886511e" with your question code.
The "rb8620b6b2c4e4eb181de495f2886511e" was my question code.
If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
How do I get the question code?
Hello @KevZF ,
please follow these steps:
If I have answered your question, please mark my post as Solved.
If you like my response, please give it a Thumbs Up.
BR,
Marco
it worked out, thanks alot!!!
Hello @MarconettiMarco,
I know that this goes beyond this Topic but maybe you can also help me out with this!
So I'm trying to add the attachment links to my approval request.
This is the Flow without the Steps that you showed me:
In the Flow where I'm trying to merge the steps that you showed me, I can't seem to get the Output I need to put into the apply to each Loop that I marked in the first screenshot.
Kind regards
Kev