cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smorley
Helper V
Helper V

Array must be of primitive type error when appending to an array variable

Hi everyone,

I'm trying to append to an array variable, and I'm getting an error.

Flow save failed with code 'WorkflowRunActionInputsInvalidProperty' and message 'The inputs of workflow run action 'Append_to_array_variable' of type 'AppendToArrayVariable' are not valid. The provided value of '[ { "Claims": "@items('Apply_to_each')?['Approver_x0020_email']" } ]' of type 'Array' must be a primitive type, or a valid template language expression.'.

The workflow itself is pretty simple:

 

appenderror.jpg

Any thoughts?

28 REPLIES 28

You don't want to append [Approver Name] into the array variable, you want to append only the email address of the approver (probably [Approver Name Email]).



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
smorley
Helper V
Helper V

Ok, so now we are back to where we started.  No errors, but it doesn't go into Append to array action.

approverlist.jpg

 

MasterList.jpg

Do you use the right 'Approver Name Email'? The output from the 'Get items'?



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
smorley
Helper V
Helper V

Strangly, it does not exist as an option in Get Items.  I deleted the action and added it again, just to be sure.  getitems.jpg

You can try to add it manually, add another 'Apply to each' inside the existing 'Apply to each', put the 'Approver Name' from 'Get items' as the 'From'. Then move the 'Append to array variable' inside that 'Apply to each' and use an expression item()?['Email'] to get the user email.

image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
smorley
Helper V
Helper V

Ok, back to a syntax error or a lack of fields to choose from.  I have since updated it to be Item not Items and same problemsecondapplytoeach.jpg

smorley
Helper V
Helper V

@tom_riha sorry I misspoke.

I changed it to items, and now it gives NULL for outputs.  So better than an error.

 

appendnull.jpg

The 'Append to array variable' must be inside the 'Apply to each 2', in the same way as on my screenshot. And the expression must be exactly like this:

item()?['Email']


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

smorley
Helper V
Helper V

Oh  my goodness, you are brilliant!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,498)