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 / Model-Driven app, Clea...
Power Apps
Answered

Model-Driven app, Clear field when another field changes?

(0) ShareShare
ReportReport
Posted on by 782
I feel like this should be pretty simple but I'm failing to accomplish it. I have a field named Payor and one named Payor Type. When my Payor Type field changes, I want to clear out any value in the Payor field. 
I would love to do this OOB instead of through code but I'm not seeing the option to do so. Please correct me if I'm wrong there.
 
Here's my JS function that I'm trying to use. I'm not great with JS so I'm sure there's something wrong here.
 
function clearPayorField(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.getAttribute("appdev_payor").setValue(null);
}
 
Categories:
I have the same question (0)
  • Verified answer
    notj Profile Picture
    782 on at
    OK, I finally got it. Most of the things I came across said use the logical name, this was incorrect. Using Schema name and updated code below resolved it. Hopefully someone in the future finds this early in their search instead of two days later like me.
     
    function clearPayorField(executionContext) {
        var formContext = executionContext.getFormContext();
        var payorField = formContext.getAttribute("appdev_Payor"); // Replace "appdev_Payor" with the actual Schema name of your field
        
        if (payorField) {
            payorField.setValue(null);
            console.log("Payor field cleared successfully.");
        } else {
            console.error("Error: Payor field is null or undefined. Please check the schema name.");
        }
    }
     
     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard