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

Community site session details

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

Issue with getting attribute value on form load

(0) ShareShare
ReportReport
Posted on by 5

Hi, 

I am trying to create validation onLoad that if a certain required field has a value, then hide it. I am using the following code to see if the field has a value:

var productInterestValue = formContext.getAttribute("znl_productinterest").getValue;

However, when I log the variable however it displays:

getValue(){const e="ClientApi.XrmEntityAttributeOptionSet.getValue";try{s.a.instance.reportCall(e);const t=this.getValueInternal(),n=Object(D.g)(t),r=Object(f.a)(n)?Object(D.f)(t,this.getAttributeType(),0):n;return s.a.instance.reportSuccess(e),r}catch(t){const n=v.a.getInstance().getEventParameters(this.contextToken);throw n.push({name:"attributeName",value:this.getName()}),v.a.getInstance().reportFailure(e,t,null,n),t}}

I'm pretty new to dynamics, so any help would be appreciated!

Thanks,

Joe

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Issue with getting attribute value on form load

    just add "()" to getValue, like this:

    var productInterestValue = formContext.getAttribute("znl_productinterest").getValue();

    When you don't add the parentheses you are asking to retrieve the function definition instead of actually calling it.

  • joecampbelluk Profile Picture
    5 on at
    RE: Issue with getting attribute value on form load

    Knew it would be something simple! Thanks so much, hopefully this answer stops someone else asking a silly question in the future!

  • Community Member Profile Picture
    on at
    RE: Issue with getting attribute value on form load

    I am glad that was it Joe!

    Please mark it as answered then.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 57 Most Valuable Professional

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 52 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans