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

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

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