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 CRM (Archived)

setVisible(true) not displaying lookup field

(0) ShareShare
ReportReport
Posted on by 155

Hi, I am trying to set the visibilty of a lookup control based on a condition of another attribute on a form. When this attribute has a value, I want the lookup control to be made visible. The issue I am having is, the Label for the lookup control is being displayed but the lookup control isn't. This is an example of what I'm trying to achieve.

var x = Xrm.Page.getAttribute("attribute").getValue();

if (x != null){

Xrm.Page.getControl("lookup").setVisible(true);

}

*This post is locked for comments

I have the same question (0)
  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Tim,

    but do you see the "--" ?

  • Tim Macintosh Profile Picture
    155 on at

    No, there is simply nothing except the field label.

  • Tim Macintosh Profile Picture
    155 on at

    The "Second Carrier" is the field in question. When the "O/L Origin" gets a value, the Second carrier should become visible. But only the label gets displayed. The "First Carrier" is visible by default.

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Tim,

    I used that code with same code, no problem at all.

    Can you give us the screenshot?

  • Aileen Gusni Profile Picture
    44,524 on at

    What if you use the Business RUle?

  • NatrajY Profile Picture
    3,040 on at

    The script is correct. Can you maybe try putting the label on the left of the controls (from section properties) to see if you get a different behaviour?

  • Aileen Gusni Profile Picture
    44,524 on at

    Yes, the script is correct, and the label position, I tried, it is OK in my environment.

    Hm..You have another script?

    What if you use different browser?

  • Suggested answer
    Tim Macintosh Profile Picture
    155 on at

    Thank you for all the suggestions.

    I tried using Chrome instead of IE but had the same issue. I also tried not displaying the label at all but this didn't worked either. I also tried moving the field in question to another section, and that didn't seem to make any difference either. Finally, I decided to move all the controls from the 'ROUTING' section into the new one column section called 'Routing 2' with the labels displayed on the side and it all worked perfectly. See screenshot below.

    2014_2D00_08_2D00_07_5F00_0945.png

    The error/bug seems to be in the positioning of the label. For interests sake, I created another four column section with the labels displayed above the controls, and got the same issue. See screen shot below.  

    As you can see, the second and third carrier controls are not being displayed only the labels.

  • NatrajY Profile Picture
    3,040 on at

    Did a quick search on connect. People who don't use left side labels, are having issues with general behaviour as well as visibility triggered by JS. Eg. connect.microsoft.com/.../812467

    So, I think best to stick with left side labels, till these issues are resolved.

  • Royal King Profile Picture
    27,686 on at

    can you uncheck "display by default" checkbox for the field and set visible only when you need to show the field in the form based on the condition?

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans