cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
smorley
Post Patron
Post Patron

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
Post Patron
Post Patron

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
Post Patron
Post Patron

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
Post Patron
Post Patron

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
Post Patron
Post Patron

@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
Post Patron
Post Patron

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,532)