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 / How to replace a value...
Power Automate
Answered

How to replace a value from an array with value from a second array do until the first array is closed ?

(0) ShareShare
ReportReport
Posted on by

Hi There,

 

I have 2 arrays and want to replace the particular value from fist array using the second array until the first array is finished.

I want to replace an item "Assignee" in the 1st array with the "Name" from second array until the 1st array length 

 

Please help!

 

Example :

1st Array 

 

[
 {
 "Incident_Number": "INC000072692977",
 "Assignee": "Blank"
 },
 {
 "Incident_Number": "INC000072693455",
 "Assignee": "Blank"
 },
 {
 "Incident_Number": "INC000072692957",
 "Assignee": "Blank"
 },
 {
 "Incident_Number": "INC000072693485",
 "Assignee": "Blank"
 },
 {
 "Incident_Number": "INC000072692973",
 "Assignee": "Blank"
 },
 {
 "Incident_Number": "INC000072694578",
 "Assignee": "Blank"
 }
]

 

 

 

2nd Array with Assignees 

 

[
 {
 "Name": "John Wick",
 "Name": "Renfield",
 "Name": "Expendables"
 }
]

 

 

OutPut array

 

 

[
 {
 "Incident_Number": "INC000072692977",
 "Assignee": "John Wick"
 },
 {
 "Incident_Number": "INC000072693455",
 "Assignee": "Renfield"
 },
 {
 "Incident_Number": "INC000072692957",
 "Assignee": "Expendables"
 },
 {
 "Incident_Number": "INC000072693485",
 "Assignee": "John Wick"
 },
 {
 "Incident_Number": "INC000072692973",
 "Assignee": "Renfield"
 },
 {
 "Incident_Number": "INC000072694578",
 "Assignee": "Expendables"
 }
]

 

 

Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,456 Super User 2026 Season 1 on at

    Hi @RadhakrishnaP ,

     

    I noticed that your 2nd array contains an object with 3 values for the same key, which is not allowed in Power Automate. In this case, I prepared the following flow assuming that those names are actually in an array and out any object (you can add a little more context about it and we can do any adjustments to make the flow fits to your use case).

     

    Step 1 - initializing the variables

    I'm initializing one variable per each array (2 first variables). Also, I have an integer variable for a counter (initial value as -1) and another array variable to store the final result (initial value as empty).

     

    rzaneti_3-1686606784008.png

     

     

    Step 2 - Looping the main array

    When looping your main array, you first will test if your counter is lower than 2. If yes, you will increment it. If not, you will set it as zero. We started the counter variable as -1 to make sure that in the first interaction your first element from arr2 (index zero) is captured. For this same reason, we put 2 (and not 3) in the condition.

    rzaneti_2-1686606747642.png

     

    Step 3 - Replace the blanks

    After that, you append to your 'final array' variable another object, which will replicate the same incident number from the original array and replace the 'assignee' for the current iteration value from the 2nd array (captured by the 'counter' variable):

    rzaneti_4-1686606864161.png

     

    The expression used in the 'assignee' is the following: variables('arr2')[variables('counter')]

     

    This is your the output after the loop in 'final_array':

    rzaneti_5-1686606931552.png

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

  • Verified answer
    CU-21081200-1 Profile Picture
    on at

    Hi rzaneti ,

     

    Thanks a lot for the explanation and the flow.

    Its a perfect solution.

     

    RadhakrishnaP_0-1686681080566.pngRadhakrishnaP_1-1686681101134.png

     

     

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
Haque Profile Picture

Haque 286

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard