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 / Get variable inside a ...
Power Automate
Unanswered

Get variable inside a power automate expression

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, Im trying to make a dynamic adaptive card that show input dynamically depending on some data fetch from my database, so far i've done quite good. But I'm stuck here. When i get the output from the adaptive card i try getting my field by a generated id with an iterator number (ex : id_iterator) so that i can loop, fetch the data and create a row in my db) but i can't manage to insert my variable inside my expression without creating a string variable before for each of my field. which i don't want to do... this is what i got so far

JayBert_0-1636575758293.png

and my expression is as followed : outputs('ad')['body/data']['Fournisseur_variables('iterator2')']

but it keep saying it's not valid. is there a to inject the variable after the '_' ?

 

other thing i tried that work (while i was testing to make sure it could work first). i just initialize the variable to inject instead of trying to get the input directly in the expression (this is what i try to avoid):

JayBert_1-1636575953695.png

outputs('adc')?['body/data']?[variables('code')]
 
 
I don't know if this all make sense. Thanks
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,757 Most Valuable Professional on at

    Hi @Anonymous,

     

    If I understand your requirement correctly a concat function might help.

     

    Which field from ADC action do you want to use in your expression together with the variables code?

     

    Below is an example of a concat:

    concat(outputs('adc')?['body/data']['somefield'],variables('code'))

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey thanks for the answer, i've tried it, and while the expression is valid, i'ts not working in my case... (Edit: i think it's because the expression is processing outputs() before concat() so it doesn't find my 'inputId_')

    JayBert_0-1636643151806.png

    I'm trying to get all id_x where x is the iterator value

    context/exemple:

    let's say i have a task table, and a people table, a person can have many task. I get all the task of a user, and build a card and send them the card with an input for each task to know if they have done it. But since i don't know how much task they had, and i want to send this card to each of them respecting their individual task. all card must be build dynamically. 

    So i manage to build the card dynamically. so it could look like this when the user receive it (exemple, i just simplified my context) cause as you can see in my error. i have many more field. wich is why i don't want to declare a variable for each of them):

    JayBert_1-1636643641010.png

    so each row was added dynamically with the id -> Task_X. so when i get the card i want to do something like:

    for( int i = 0; i < rowcount; i++)

    {

         get my field value dynamically (Task_i)

    }

     

     

    Sorry if it's still not super clear... it makes sense in my head. for now i'll go for my solution that i wanted to avoid since i know it's working... i'll wait for your input.

  • Expiscornovus Profile Picture
    33,757 Most Valuable Professional on at

    Hi @Anonymous,

     

    It does make sense. You want to dynamically determine what the correct field is to retrieve in the expression. You want to do that by using an iterator and to apply the code variable with the correct incremented integer value. So if you would be in row 3 of your do while loop, the field in the expression you want to retrieve would be Fournisseur_3. 

     

    However, it looks like the expression editor can't handle this kind of logic. I have also tried several things. It will just output the variable as a string and doesn't use it to retrieve the correct field.

     

    I am interested in the actions before your do while loop. We might be able to find a workaround for this. Can you share the first part of your flow with the ADC action?

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