Reputation: 311
Is there a way in CRM 2011 to get the default view id for a custom entity? Using JavaScript I want to dynamically generate a HREF but I don't want to hard code any part of the URL. I know how to get the Server URL and Org name in the link below but not this portion "etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b"
http://dev:5555/MyOrg/main.aspx?etc=2&extraqs=%3f_gridType%3d2%26etc%3d2%26id%3d%257b
Upvotes: 1
Views: 3370
Reputation: 1581
You can query public views just like any other entity in CRM. The entity name is SavedQuery and there are properties for returnedtypecode
(Entity Name), isdefault
, and querytype
(the type of query it is).
So with that in mind you can make a query to the OData or Soap endpoints from JavaScript to get the default query for any entity type.
Upvotes: 1
Reputation:
Take a look at: http://msdn.microsoft.com/en-us/library/gg334266.aspx
You should be able to use something like:
var defaultViewId = Xrm.Page.getControl("<lookup field name>").getDefaultView()
Upvotes: 0