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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

getDefaultView returns empty string

(0) ShareShare
ReportReport
Posted on by 216

Here's a strange one... running getDefaultView on lookup controls (Xrm.Page.getControl("my_lookupid").getDefaultView()) returns... an empty string. This seems to be for all lookup controls, regardless of the form.

Is this some known bug in version 8.2.9.19?

I have the same question (0)
  • Suggested answer
    Thangamani Profile Picture
    507 on at

    Hi,

     There is no bug and this single line of code works very nicely and even i am using MSCRM 2013 and the same code is working fine for us.So this feature is working from the previous version and the existing features will not break in the newer version.

    Code

    // add the default View GUID for the view id

    var viewId = Xrm.Page.getControl(“new_projecttemplateitemid”).getDefaultView();

    This single piece of line works like a charm.

    Hope this helps.

    Regards,

    Thangamani

  • MateuszBender Profile Picture
    216 on at

    Well, the line you wrote is identical to my line (sans control name, but that's expected).

    I WAS, eventually, able to get the ID via getElementById() and then getAttribute("defaultviewid").

  • okank Profile Picture
    70 on at

    We have the same case. Also Xrm.Page.data returns null. It's a create form opened from a related entities grid. Anyone knows the cause?

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans