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. ]
smorley
Post Patron
Post Patron

Oh  my goodness, you are brilliant!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

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

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,947)