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 Apps / Problems with OnChange
Power Apps
Unanswered

Problems with OnChange

(0) ShareShare
ReportReport
Posted on by 109

Hi everyone,

apparently easy task but I'm not able to get it.

I have a sharepoint list and in the connected personalized powerapp form I want to save the author of the change of a specific check/uncheck (Sistemato): if the status changes to "checked" I want to put in the field "Autore" the User().Fullname while if it is changes to "unchecked"  I want to set in the field "Autore" a blank. On the same time, obvisiously, if I retrieve the data for modification and the status was already "checked" I want the author to be the same as before.

What I get instead is that each time the author changes and is the new user.

 

I tried several combination, that sounds sensible (but evidently are not), such putting in the OnCheck/OnChange/OnUncheck of the check/uncheck control the set of a variable and in the field "Autore" an if command that says that if that very variable is null to take the Parent.Default.

 

Whatever I do it always takes the new User().Fullname, like if the OnCheck/OnChange/OnUncheck is triggered even if it was already on that status before of the modification.

 

Can someone help me resolving this tricky but apparently silly problem?

Thanks in advance

 

RikiVitalets_0-1660203683306.png

 

 

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @RikiVitalets ,

     

    I would set the Default property for the Autore field to:

     

     

    If(Sitemato.value, User().Fullname)

     

     

     

  • RikiVitalets Profile Picture
    109 on at

    Uhmmm... why should this work? It will change the "Autore" the next time someone will open a form with "Sistemato" already set on true with his name even if he/she hasn't changed the status... my goal is to keep the name of the original person that changed the "Sistemato" status... oncheck of check/uncheck command should be triggered only on the event, instead apparently it happens even if it was already set on true when opened the next time by someonelse... this seems to be the problem to me...

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @RikiVitalets ,

     

    Sorry, I assumed this would only be used for creating new entries. If you also want to use for existing entries, maybe this is the way to go:

     

    Sistemato.OnCheck:
    
    UpdateContext({_temp, Autore.Text});
    Patch(DataSource, Record, {Autore: User().DisplayName})
    
    Sistemato.OnUncheck:
    
    Patch(DataSource, Record, {Autore: _temp})

     

    Upon checking the toggle, this temporarily saves the value of the Autore field in a context variable before patching the updated value to the data source. If the users then UnChecks, the original value will then be restored from the context variable.

  • RikiVitalets Profile Picture
    109 on at

    Hi @BCBuizer ,

    thank you so much for your help but I don't follow you. I'm having some trouble with the command (apart from some commas that look different in my standard, see below, what should I put in the "record" field?) and maybe you can help me further. but the behaviour you explain seems different from what I looking for...

    If I correclty understand your point you put in the _temp variable the old "Autore" when Sistemato.onCheck is triggered and use the parameter to set "Autore" to the old value whe Sistemato.onUncheck is triggered, am I right? If so this doesn't prevent the "Autore" field to be changed when the new one will make modification to other fields (but no to Sistemato), and by the way it is not what I'm looking for: I want that when Sistemato.onUncheck the "Autore" field will be blank (and that is easy) and if the status of Sistemato was already checked the "Autore" remains the old one.

     

    RikiVitalets_0-1660221654208.png

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @RikiVitalets ,

     

    Never mind, I left out the variable.

     

    You can use a LookUp to retrieve the record you want to update as per below example:

    Sistemato.OnCheck:
    
    Patch(ErroriFatureBolle; LookUp(ErroriFatureBolle, ID = IDDataCardValue); {Autore: User().DisplayName})
    
    Sistemato.OnUncheck:
    
    Patch(ErroriFatureBolle; LookUp(ErroriFatureBolle, ID = IDDataCardValue); {Autore: ""})

     

  • Verified answer
    RikiVitalets Profile Picture
    109 on at

    Guess it is similar to what you are posting above, by the way I solved it with this in the Autore.Text

     

    If(SharePointIntegration.Selected.Sistemato;If(TglSistemato;Parent.Default;"");If(TglSistemato;User().FullName;""))

     

    Practically it gets the previous status of Sistemato and keep the author without changing it, but if the Sistemato goes to False Autore goes to blank. If Sistemato goes to True again in the same session keeps the old Autore.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard