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

Notifications

Announcements

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,413 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard