Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Toggle (yes/no) choice does not stick

(0) ShareShare
ReportReport
Posted on by 248

Hello again.

 

I created a canvas app that is connected to a sharepoint list.  I have a screen that has a gallery on the left and form data on the right.  One of the columns is a yes/no toggle.  When the user chooses a yes/no, the choice reverts back to the original.  The formulas that i am using are:

 

OnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':true,'Exported by whom':User().FullName,'Exported Date':Now()});

 

UnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':false,'Exported by whom':User().FullName,'Exported Date':Now()});

 

Default on the datacard:  Blank

Default on field:  If(ThisItem.'Has the pdf been exported?'= true, true, false)

 

When the user toggles, you can see in the gallery the one that was selected "blinks" and then goes back to the original choice.

 

Any ideas?  

 

Thank you for your time!

  • Misa Profile Picture
    248 on at
    Re: Toggle (yes/no) choice does not stick

    My apologies @v-bofeng-msft .  Yes you were correct.  I commented out the formulas in both OnCheck/UnCheck and added the formula to OnChange and the toggle stayed.  Woohoo!  

     

    Thank you so much for your assistance!!

  • Verified answer
    v-bofeng-msft Profile Picture
    on at
    Re: Toggle (yes/no) choice does not stick

    Hi @Misa ,

     

    Could you please tell me:

    What is the form's data source? What is the form's item property ?

     

    If the form's data source is 'Letter Templates' and the form's item is gal_EmpList.Selected, you could try:

     

    OnChange:  Patch('Letter Templates',ThisItem,{'Has the pdf been exported?':Self.Value,'Exported by whom':User().FullName,'Exported Date':Now()});

     

    Toggle's default :  ThisItem.'Has the pdf been exported?'

     

    vbofengmsft_0-1675220726801.png

    vbofengmsft_1-1675220737650.png

    vbofengmsft_2-1675220751547.png

     

     

     

    Best Regards,

    Bof

     

     

  • Misa Profile Picture
    248 on at
    Re: Toggle (yes/no) choice does not stick

    @v-bofeng-msft 

    Where is the toggle? In the gallery or in a form?  The toggle is on the form, not the gallery

    What is gal_EmpList? Is it a gallery? gal_Emplist is the gallery

    What is gal_EmpList's items property? What is the form's data source? What is the form's item property?  Items property:  Filter('Letter Templates', lbl_SearchBox.Text in 'Employee Name'.DisplayName || lbl_SearchBox.Text in 'Employee Name'.Claims)

    What is 'Has the pdf been exported?'? Is it a 'Yes/No' column? Yes

     

  • v-bofeng-msft Profile Picture
    on at
    Re: Toggle (yes/no) choice does not stick

    Hi @Misa ,

     

    Could you please show me ,

    Where is the toggle? In the gallery or in a form?

    What is gal_EmpList? Is it a gallery?

    What is gal_EmpList's items property? What is the form's data source? What is the form's item property?

    What is 'Has the pdf been exported?'? Is it a 'Yes/No' column?

     

    vbofengmsft_0-1675218497617.png

     

    Bes Regards,

    Bof

     

     

  • Misa Profile Picture
    248 on at
    Re: Toggle (yes/no) choice does not stick

    Of course @v-bofeng-msft .  To make sure i send the correct screenshots, which would you like?

  • v-bofeng-msft Profile Picture
    on at
    Re: Toggle (yes/no) choice does not stick

    Hi @Misa ,

     

    Could you please show me some screenshots?

     

    In addition, maybe you could try:

     

    OnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':true,'Exported by whom':User().FullName,'Exported Date':Now()});Refresh('Letter Templates');ResetForm(FormName)

     

    UnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':false,'Exported by whom':User().FullName,'Exported Date':Now()});Refresh('Letter Templates');ResetForm(FormName)

     

    Default on the datacard:  Blank

    Default on field:  LookUp('Letter Templates',ID=gal_EmpList.Selected.ID).'Has the pdf been exported?'

     

    Best Regards,

    Bof

  • Misa Profile Picture
    248 on at
    Re: Toggle (yes/no) choice does not stick

    Thank you for your response @v-bofeng-msft.  I tested the formula and it is still reverting back.

  • v-bofeng-msft Profile Picture
    on at
    Re: Toggle (yes/no) choice does not stick

    Hi @Misa ,

     

    You could set the toggle's default to:

     

    LookUp('Letter Templates',ID=gal_EmpList.Selected.ID).'Has the pdf been exported?'

     

    Best Regards,

    Bof

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1