web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

TypeError: formContext.getAttribute(...).getvalue is not a function

(2) ShareShare
ReportReport
Posted on by 6
I trying to hide the tab when the work order is not completed or invoices. I am getting the following error "TypeError: formContext.getAttribute(...).getvalue is not a function" for the following piece of code:
 
function TabHideOnLoadOnChange(executionContext){
    var formContext = executionContext.getFormContext();
    var WorkOrderStatus = formContext.getAttribute("sog_parentstatus").getvalue();
    var TabName = formContext.ui.tab.get("Survey_tab");
 
    var complete = 922830005;
    var invoiced = 922830006;
 
    if (WorkOrderStatus == complete || WorkOrderStatus == invoiced){
        TabName.setVisibile("true");
    }
    else{
        TabName.setVisibile("fasle");
    }
 
}
I also checked if the "sog_parentstatus" is present in the form and I am able to locate the field in the form, still I am getting the same error.
Screenshot 2024-11-11 115052.png
Categories:
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at
    hi
     
    Make sure that the sog_parentstatus attribute is correctly set up in your form and that it returns a valid value.
     
    DAniele
  • Verified answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    The issue here is due to two main problems:
     
    1. Incorrect Method Name: getvalue() should be getValue().
     
    2. Incorrect Parameter Type in setVisible(): The setVisible() method expects a boolean parameter (true or false) rather than a string.
     
    Here’s the corrected code:
     
    function TabHideOnLoadOnChange(executionContext) {
        var formContext = executionContext.getFormContext();
        var WorkOrderStatus = formContext.getAttribute("sog_parentstatus").getValue();
        var TabName = formContext.ui.tabs.get("Survey_tab");
     
        var complete = 922830005;
        var invoiced = 922830006;
     
        if (WorkOrderStatus == complete || WorkOrderStatus == invoiced) {
            TabName.setVisible(true);
        } else {
            TabName.setVisible(false);
        }
    }
     
    Explanation of the Changes
     
    getValue(): Use getValue() instead of getvalue() to retrieve the value.
     
    setVisible(true/false): Pass true or false directly (no quotes), as setVisible() expects a boolean value.
     
    This should resolve the error you’re facing and allow the tab visibility to work based on the WorkOrderStatus.
  • Suggested answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    Is this issue resolved or still facing the issue ?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
Pallavi Phade Profile Picture

Pallavi Phade 32

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans