Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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

 

 

  • rogueone Profile Picture
    17 on at
    Re: ServiceNow - Replace Array values with another value

    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

     

     

  • Verified answer
    Mira Ghaly Profile Picture
    11,409 Super User 2025 Season 1 on at
    Re: ServiceNow - Replace Array values with another value

    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!

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow