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 Apps / Set Variables not working
Power Apps
Unanswered

Set Variables not working

(0) ShareShare
ReportReport
Posted on by 9

I have an the following code on the OnVisible property of the screen:

Set(varShowImagebox, false)

 

I have another icon whose OnSelect property has 

Set(varShowImagebox, true)

 

I have a text box for testing purposes whose Text field has

varShowImagebox

 

But when i click on the icon the textbox value does not change.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,393 Most Valuable Professional on at

    Hi @soumitra ,

    You need varShowImagebox as the Visible property of the Text box

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • soumitra Profile Picture
    9 on at

    Tried it, doesn't change. I have it as the text value just to see if the value of varShowImagebox  changes on click of the icon.

  • WarrenBelz Profile Picture
    156,393 Most Valuable Professional on at

    @soumitra ,

    To be clear,

    1. You have an icon with the OnSelect of Set(varShowImagebox, true)
    2. The value of varShowImageBox is false
    3. It remains false after you press the icon

     

     

     

  • soumitra Profile Picture
    9 on at

    yes correct, it stays false

  • WarrenBelz Profile Picture
    156,393 Most Valuable Professional on at

    @soumitra ,

    The only possibility is that you have a context variable with the same name (you have set this)

    UpdateContext({varShowImagebox:false})

    or you have a bug in the app - try another icon.

     

  • Devikumari Krishna Profile Picture
    988 Super User 2024 Season 1 on at

    Hi @soumitra ,

     

    I suggest to try the below.

     

    Keep 3 icons - Save, Edit, Cancel

    Keep the default Save Icon  Visible : false

    Keep the Code on Edit Icon   On SelectSet(varIconVisible,true); 

    Keep the Code on Cancel Icon On Select -Set(varIconVisible,false); 

    Keep a label  Text : varIconVisible

     

    This will work as expected 🙂 You can change the icons as per your need.

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

    My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/


    My Youtube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A

    Regards
    Devi

     

  • WarrenBelz Profile Picture
    156,393 Most Valuable Professional on at

    @DeviKrishna ,

    Thank you for your input, but it does not explain why the OnSelect of the current icon does not change the value of the Variable.

  • Devikumari Krishna Profile Picture
    988 Super User 2024 Season 1 on at

    Hi @WarrenBelz 

    I assumed that the variable value was not reset and hence onselect was always showing true.

    That's y introduced the cancel icon to reset the variable value to false.

     

    If you like my response, please give it a Thumbs Up.

    My Blog: Dynamics 365 Key Topics – https://d365topicsbydk.com/

     

    My Youtube Channel : https://www.youtube.com/channel/UCxSIryP2ah2VpEFr-Z72t1A

     

    Regards
    Devi

  • WarrenBelz Profile Picture
    156,393 Most Valuable Professional on at

    Hi @DeviKrishna ,

    I was just trying to keep on topic as @soumitra has stated the Variable is false and will not set to true (which makes no real sense unless there is something conflicting such as a context variable which will take precedent),

  • Abhilash_Swain Profile Picture
    901 on at

    faced a similar issue. Please rename the variable and try. if global and local variables are of the same name, It will always show your local value.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard