Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Ectracting values, "userDefinedFields"

(1) ShareShare
ReportReport
Posted on by 14

Hi,

 

I have built a flow where I managed to extract values from "userDefinedFields" so that I can send email to emailadresses coming from "Epostadresse mottaker av egenkontroll" (a user defined field). I want to send different emails to the different adresses, and I want to build the body of the email using some of the other user defined fields.


So I have tested it, and it worked - until I changed a value (text basically)  in the system where the data comes from.

So I am using indexing (hardcoded index...or something?) to get the values using a expression like: items('Apply_to_each')?['data']['userDefinedFields']?[2]?['value']

 

This expression did extract the email adress, because "Epostadresse mottaker av egenkontroll" was the third user defined field in the data. But when I changed some text in one of the fields, the result attached showed that the user defined field "Epostadresse mottaker av egenkontroll" now was number two.


So the order of the fields are not set or consistent. 

 

Is there a way to extract these values based on the name of the user defined field, and not using  [0] og [1] or [2]?

 

WilliVev_0-1697925301949.pngWilliVev_1-1697925314491.png

 

  • abm abm Profile Picture
    32,464 Most Valuable Professional on at
    Re: Ectracting values, "userDefinedFields"

    Hi @WilliVev 

     

    Yes in your case body is an array so it must be inside a loop. Glad to hear that all sorted and thanks for accepting the solution.

     

    Thanks

  • WilliVev Profile Picture
    14 on at
    Re: Ectracting values, "userDefinedFields"

    Hi @abm ,

     

    Thank you! I first created three different loops, but I soon discovered that I could not acess all user defined fields outside the loop to send a emai. So i did what you suggested x 3, for the three fields, inside one loop. Works perfectly together with the send email action now.

     

    Thanks again!

  • Verified answer
    abm abm Profile Picture
    32,464 Most Valuable Professional on at
    Re: Ectracting values, "userDefinedFields"

    Hi @WilliVev 

     

    Map that Userdefinedfields in a compose then use a filter array to extract the desired value. Here is an example.

     

    image.png

     

    Above use expression item()['name']

     

    image.png

     

    Above expression is as follows:

     

    outputs('Filter_array')?['body']?[0]?['value']
     
    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

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,679 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow