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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Users online (1,922)