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 / Get the value of Yes/n...
Power Apps
Unanswered

Get the value of Yes/no field

(0) ShareShare
ReportReport
Posted on by 102

In my model driven app, There is an Yes/No field

jaya80980_0-1681924073444.png

 

I am trying to get its value using Javascript

var acpStatus = formContext.getAttribute("wti_acp").getValue();

 

But it is throwing error.

formContext.getAttribute is not a function

 

Can someone please help

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    if you are actualy using 'var acpStatus = ' to set your variable then that wont work. You will need to use UpdateContext or Set depending what type of variable you need. (UC = local var, Set = global var). Here is how to do this using the yes/no value of the first item in a SPList called Test for example:

    UpdateContext({acpStatus: First(Test).YesNoColumn}) -> Local var only visible to that screen

    or

    Set(acpStatus, First(Test).YesNoColumn) -> Global var visible to entire app on any screen

     

    Example using a lookup:

    UpdateContext({acpStatus: LookUp(Test, Name = Dropdown1.Selected.Value).YesNoColumn})

  • jaya80980 Profile Picture
    102 on at

    Hello @mmollet 

    My question is on model driven application and customisation using Javascript.

    formContext and other variables refer to JavaScript and not canvas app variable declaration.

     

    Highly appreciate the time taken to reply.

     

    Thanks.

  • Glü10 Profile Picture
    5 on at

    Hi @jaya80980 .
    It looks like your error is about you're trying to invoke a method of a not defined object (formContext) because the method cannot been found.
    i think you should check you have correctly initializated the 'formcontext' object with a similar sentence:

    function yourMethod(executionContext) {
        var formContext = executionContext.getFormContext();
        .....
    Then you can invoke the formContext object and its methods. The parameter should be the name of the field.

    Remember that you should set the check about PASS THE CONTEXT to the method in the event handler at Power Apps Studio.

    Gl10_0-1682685380333.png

     

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 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard