web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add dynamically new pr...
Power Automate
Unanswered

Add dynamically new properties to existing array power automate

(0) ShareShare
ReportReport
Posted on by 4

I get response from an HTTP action and response is an Array like this :

{

"orderLines": [
{
"lineNumber": 1,
"productId": 100788762,
"brand": "test",
"productName": "productname",
"brandSku": "11-11-111",
"categories": [
{
"id": 31122,
"name": "Komponenter"
},
{
"id": 31134,
"name": "Audio"
}
],
"serialNumbers": []
},
{
"lineNumber": 2,
"productId": 100788232,
"brand": "test",
"productName": "productname",
"brandSku": "11-11-111",
"categories": [
{
"id": 31122,
"name": "Komponenter"
},
{
"id": 3134,
"name": "Audio"
}
],
"serialNumbers": []
}
]
}

 

And for each item i want add new properties (TrackandTrace,TrackandTracePath) like this :

{

"orderLines": [
{
"lineNumber": 1,
"productId": 100788762,
"brand": "test",
"productName": "productname",
"brandSku": "11-11-111",
"categories": [
{
"id": 31122,
"name": "Komponenter"
},
{
"id": 31134,
"name": "Audio"
}
],
"serialNumbers": [],

"TrackandTrace":"xxx",
"TrackandTracePath":"xxx"
},
{
"lineNumber": 2,
"productId": 100788232,
"brand": "test",
"productName": "productname",
"brandSku": "11-11-111",
"categories": [
{
"id": 31122,
"name": "Komponenter"
},
{
"id": 31134,
"name": "Audio"
}
],
"serialNumbers": [],

"TrackandTrace":"xxx",
"TrackandTracePath":"xxx"
}
]
}

 

Here is my flow :

Initialize New array:

Capture0.PNG

HTTP action:

Capture1.PNG

Assgin Value to varArrayLineExtraObj:

orderLines is an Array

Capture3.PNG

Loop:

Capture4.PNG

 

 

I know there is AddProperty , but how can i pass this properties dynamically TrackandTrace,TrackandTracePath to AddProperty and assgin them to each item in loop!

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,390 Moderator on at

    Hi, @co21, I think that you have two options based on what you have said so far.

     

    addPropertiesDemo001-Setup.jpg

    ( originalObject here represents your html response, you may need to add levels to get to ?['orderlines'] )

    Add Extra Fields With Bespoke Information

    This will feel simpler or more logical to do which is why I'm mentioning it first. It also allows a semblance of automatic information to be included.

     

    So, if you know that those keys will never change, then you can simply create a a Select action after the HTML request on the 'orderLines' array. Just add all the fields that are already there, and add two additional ones with the data that you need.

     

    For each value you just add the relevant expression to pull that key from the old array. So for 'productId' that would be:

    item()?['productId']

    That looks at the item in the orderLines array and takes the value of the 'productId' field from it!

     

    This would be super-fast in flow terms, and would allow you to then either process that elsewhere, or dynamically add additional information within that Select action.

     

    For example, if the 'TrackandTrace' key is a combination of 'productId', two dashes, then the 'productName', then you'd use this in the value side:

     

    concat(item()?['productId'], '--', item()?['productName'])

     

    That would produce a "100788762--productname" value for your first item.

     

    In my example, I also made the TrackandTracePath do this:

    concat('/(', item()?['productId'], ')', item()?['productName'], '/TrackandTrace')

    Which for the first item would produce a "/(100788762)productname/TrackandTrace" value in that field.

     

    Simpler Method - Add Blank Fields

    This would also be able to be done with unknown key names, too, and just inserting null 'TrackandTrace' and 'TrackandTracePath' keys, using something like this:

     

    addProperty(addProperty(item(), 'TrackandTrace', null), 'TrackandTracePath', null)

     

    To add that, you switch the You would add that using the 'JSON' view ("text mode") of the Select key/value pairs. The button is just to the right and looks like this:

    text view.jpg

     

    You could include *some* customisation there, but it would start to get complex.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard