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 / Passing Dynamic Variab...
Power Automate
Unanswered

Passing Dynamic Variables to UI element selectors

(1) ShareShare
ReportReport
Posted on by 42

I was trying to Automate desktop application (Note Pad) where BOT should be able to click on "File", BOT Can able to click Menu item File, But when I try to pass the same Value "File" via Variable  it throws error.

One of the below Image contains passing the direct as Value/Text  "File" (which works file). 

and another one contains passing the value "File" via Variable called %NewVar1% (which throws error as Ui Element not found).

could any one clarify on the same ? is it something like we can't pass variables for selecting dynamic Selectors for Desktop Application ? this works fine for web automation .

 

Abisheck_Canary_0-1694086749793.png

Abisheck_Canary_1-1694086786431.png 

Abisheck_Canary_2-1694087971988.png

 

 

I have the same question (0)
  • Verified answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at

    That's a bug in Power Automate Desktop. When using variables in UI element it sometimes doesn't work if you haven't put Text editor -toggle On. It should work after you put it in Text editor view and save the UI element.

    eetuRobo_2-1694091319188.png

     

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You should enable the "Text editor" on the variable view for variables to work properly.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Shanmugapriya09 Profile Picture
    10 on at

    I'm also facing the same issue when I'm passing dynamic variable to the selectors.

    Shanmugapriya09_1-1717140365261.png

     

     

     

    Shanmugapriya09_0-1717140343590.png

    And I toggled 'text editor' on  , but still I'm facing same issue. if I pass values instead of variable I'm getting correct.

  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at

    Check that your variables have correct value. So I assume the %item% -variable has value "files" in it and nothing else? And its correct capitalization. 


    Just to make sure when you toggled the text editor on you saved it and tried again? In your pictures you don't have the text editor toggle on.
    What if you press "Test" does it work then when you have the variable in the Name attribute?
    Also make sure that you don't have Power Fx enabled flow since then the referencing to variables is different: ${item}

  • Shanmugapriya09 Profile Picture
    10 on at

     

    Shanmugapriya09_0-1717144347555.png

    Shanmugapriya09_1-1717144556643.png

     

    yes in my variable i've correct value and I toggled the text editor on and also i didn't enable Power Fx in my flow. so what will be the issue?

    Thanks in advance.



  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at

    Oh thats a list you are trying to refer to. I thought you had variable named "item"
    How you refer to first item on a List is %List[0]%. That item in your case would return "Enable "Discussion Topic""

    eetuRobo_0-1717146848754.png

    Then second would be %List[1]% and so on. (in your list that would be Enable "Meeting Notes")

     

    So like this in ui element:

    eetuRobo_3-1717147191140.png

     

    So when you refer to variable use the names that are in the Flow variables section on the side:

    eetuRobo_2-1717147040426.png

    And if they are variables like lists or datatables you need to specify what value you want inside of them. So In a list its simple to just tell the item index. With datatable you would need to specify Column and a row. %datatable[0][0]% would be first row first column.

  • Shanmugapriya09 Profile Picture
    10 on at

    Looping the List and its storing it in var %item% and this %item% i'm passing to selectors.
    And also tried this way also %List[0]% . In the list only 0th index(Enable "Discussion Topic") is getting error others working fine.

  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at

    Oh okay. Then I would still double/triple check that the first item (Enable "Discussion Topic") is character by character exactly the same as in the ui element you are trying to refer to in the web page. So that there is no extra spaces or different capitalization or two single quotes on each side instead of double quotes etc.

    Could you test the ui element in the selector window with the text that is in the list the first item. Does that give green check marks or does that return error?

    eetuRobo_0-1717147524791.png

     

  • Shanmugapriya09 Profile Picture
    10 on at

    I tested UI element (Enable "Discussion Topic") from webpage and also from the list both giving Selector syntax is invalid. But instead of passing the variable %item% if I directly pass the value (Enable "Discussion Topic") it gives green check mark 

  • eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at

    Can you check if you change the order of the list does it still work with everything else but 'Enable "Discussion Topic"'

    Only thing that comes to mind is that the first item (Enable "Discussion Topic") has double quotes in it when the rest doesn’t. So maybe that breaks it for some reason. Maybe it should be encoded to URL. So doublequotes would need to be replaced with %22 

     

    For troubleshooting maybe try having testItem variable where you have Discussion Topic as the value (without the double quotes) and in the UI element have Name attribute Contains
     

    eetuRobo_1-1717155031588.png

     

    eetuRobo_0-1717154813611.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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard