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

approval problem with dynamic data mail

Hello, 

 

I get mail info in json from power apps, I want to use this mail for an approval in power apps but I get this error : 


Failed to save the flow with the "InvalidTemplate" code and the message "Template validation failed:" The entries for the "Condition_2" template action in row "1" and column "3099" cannot reference the "Start_and_wait_for_approval" action. The "Start_and_wait_for_approval" action is nested in a multi-level foreach scope. Referencing of repeat actions from outside the scope is only supported in the absence of multiple nesting levels.

 

AlexisVossloh_0-1630421902658.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AlexisVossloh 

 

You will need to use a select to select the first object of the mail array from your sample array (which is another array of objects) and we then map these mail objects using item()?['mail']

 

DamoBird365_2-1631518985399.png

All of the expressions are included in the highlighted notes.  The output from above is as follows:

DamoBird365_1-1631518925066.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

6 REPLIES 6
DamoBird365
Super User
Super User

Hi @AlexisVossloh 

 

If your json is an array of emails and you want to submit them all to the single approval action, you need to use

 

join( dynamic value for array, ‘;’) 

 

this will get you a string of emails separated by ;

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

Sorry for the late reply

 

so I put following your answer :

join(items('Apply_to_each_3')['mail'],';')

but I still get the same error message 😔

You would want to join the emails before the apply to each, in fact, you shouldn't need the apply to each at all.

 

Are your emails in an array like {'Email1.com','Email2.com','Email3.com'} or are they in individual objects? like [{'email':'email1.com'},{'email':email2.com'}] ?  In which case you would need to use a select action to create an array of emails and then join to bring them together.

 

If the above doesn't make sense, share some details on your email array.

 

Damien

this is what my mail table returns

[
  {
    "mail": [
      {
        "mail""Mail1@mail.com"
      },
      {
        "mail""Mail2@mail.com"
      }
    ],
    "roles": [
      {
        "roles""user"
      },
      {
        "roles""admin"
      }
    ]
  }
]

 

 

Hi @AlexisVossloh 

 

You will need to use a select to select the first object of the mail array from your sample array (which is another array of objects) and we then map these mail objects using item()?['mail']

 

DamoBird365_2-1631518985399.png

All of the expressions are included in the highlighted notes.  The output from above is as follows:

DamoBird365_1-1631518925066.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

i have this error message : 

Unable to process template language expressions in the "Select" action entries in row "1" and column "47641": "The template language function "first" requires its parameter to be an array or string. The value provided is of type "Object". 

 

Is strange 😕

 

 

 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Users online (2,622)