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 / ServiceNow - Replace A...
Power Automate
Answered

ServiceNow - Replace Array values with another value

(0) ShareShare
ReportReport
Posted on by 17

Hi

 

I built a flow to query service now for changes, if there are none on the day it end and if there are any, it create a html table from the output array and email it out. The flow work great except the assigned to field return the user id and not the name which is expected behavior. We can use the Get User step and query that user id to return the name from the user table instead. The part i am struggling with is how to do that for all the user id's in the array. 

 

rogueone_0-1660882852263.png

 

Thanks

 

 

Categories:
I have the same question (0)
  • Verified answer
    Mira Ghaly Profile Picture
    11,415 Moderator on at

    Hi @rogueone

    1. You will need to Initialize an array variable

     2. Apply to each on the List Records

    3. Inside the Apply to each call the Get User Action 

    4. Construct a compose json object and pass all the values

    {
    "ChangeDirection":Value from Apply to each,
    "Assigned": Name from Get User
    }

    5. Call Append to array variable and add the compose data operation

    6. Outside the apply to each loop pass the array to the create HTML action

     

    Hope this makes sense!

     

  • rogueone Profile Picture
    17 on at

    Hi @Mira_Ghaly 

     

    Thank you for your answer. It took me a minute but i have managed to follow your steps and get it working in the end.  

     

    ps. Is there a way to change the array we created to dynamic content? I couldn't create html table with custom fields from that array, had to use automatic which broke my html formatting but i fixed it by updating the json.

     

    Screenshot below in case someone else need it in the future: (for the html URL link to work correctly you need to use the output of create html table in a new compose variable and add the expression below for the link to show correctly in an email:

    replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')

     

    rogueone_0-1660905557877.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
David_MA Profile Picture

David_MA 103 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 87

#3
trice602 Profile Picture

trice602 63 Super User 2026 Season 1

Last 30 days Overall leaderboard