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)

Create additional associated view

(0) ShareShare
ReportReport
Posted on by 4,930

Hi,

is it possible to create an additional associated view for an entity?

I would like to have one default associated view, displaying only the activate associated records and a second one (which the user can select in the drop down), that Shows all incative associated records.

How can this be established?

thx a lot in advance

Thomas

*This post is locked for comments

I have the same question (1)
  • Verified answer
    Community Member Profile Picture
    on at

    No, you cannot create more Associated views, or any other type of "system" views (Advanced Find, Quick Find, Lookup).

    If you use a subgrid on the form instead of using the related entity navigation, you can choose to show a drop-down list of alternative views, and restrict these to only the views which are relevant or useful in that context.

  • tpeschat Profile Picture
    4,930 on at

    Hi Adam,

    thx a lot for your feedback.

    Sub grid isn't an option for me, since our contact mask will carry already lots of Information and I do not want to overload it. So I'll go for the related entity navigation.

    In worst case I would display active and inactivat associated records in the view and the users could use the filters, but I don't like this option.

    Wouldn't it be possible to export the view and then update the fetch XML of that view, so that it provides the same result like an associated view?

    I'll check for that way.

    br Thomas

  • tpeschat Profile Picture
    4,930 on at

    OK, checked the fetch XML of the associated view and well the lookup to the regarding user is not part of the query ...

    So, no way to add additional associated view :(

    Will live with the filters

    thx Thomas

  • tpeschat Profile Picture
    4,930 on at

    Actually the default "active" and "inactive" record views deliver what I need, no customizations needed at all

  • Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    It is possible to create new additional Associated view using C# code.

    Below is the code

    // Create the view.
                        System.String layoutXml =
    @"<grid name='resultset' object='3' jump='name' select='1' 
        preview='1' icon='1'>
        <row name='result' id='opportunityid'>
        <cell name='name' width='150' /> 
        <cell name='customerid' width='150' /> 
        <cell name='estimatedclosedate' width='150' /> 
        <cell name='estimatedvalue' width='150' /> 
        <cell name='closeprobability' width='150' /> 
        <cell name='opportunityratingcode' width='150' /> 
        <cell name='opportunitycustomeridcontactcontactid.emailaddress1' 
            width='150' disableSorting='1' /> 
        </row>
    </grid>";
    
                        System.String fetchXml =
                        @"<fetch version='1.0' output-format='xml-platform' 
        mapping='logical' distinct='false'>
        <entity name='opportunity'>
        <order attribute='estimatedvalue' descending='false' /> 
        <filter type='and'>
            <condition attribute='statecode' operator='eq' 
            value='0' /> 
        </filter>
        <attribute name='name' /> 
        <attribute name='estimatedvalue' /> 
        <attribute name='estimatedclosedate' /> 
        <attribute name='customerid' /> 
        <attribute name='opportunityratingcode' /> 
        <attribute name='closeprobability' /> 
        <link-entity alias='opportunitycustomeridcontactcontactid' 
            name='contact' from='contactid' to='customerid' 
            link-type='outer' visible='false'>
            <attribute name='emailaddress1' /> 
        </link-entity>
        <attribute name='opportunityid' /> 
        </entity>
    </fetch>";
    
                        SavedQuery sq = new SavedQuery
                        {
                            Name = "A New Custom Public View",
                            Description = "A Saved Query created in code",
                            ReturnedTypeCode = "opportunity",
                            FetchXml = fetchXml,
                            LayoutXml = layoutXml,
                            QueryType = 0
                        };
    
                        _customViewId = _serviceProxy.Create(sq);
                        Console.WriteLine("A new view with the name {0} was created.", sq.Name);

    Here Query type you need to change to 2 for associated view.



  • Suggested answer
    ImAPilot Profile Picture
    70 on at

    Responding to this older post: In D365 Online Server version: 9.2.22021.00131 it turns out that YES, you can have multiple associated views.

    In our case, we have used multiple sub-grids on tabs of related entities to quickly show pertinent related info. To accommodate a narrower screen width in the related entity tab (especially on mobile platforms) we like to have a special, more condensed view that is only used on the related entity. Since the native UI doesn't support creating multiple associated entities, the narrower view also appears in the list of views for the base entity, which clutters the list of views. Thanks to @BipenKumar for the idea - In addition to custom code, you can also do this for an existing view by exporting the view in a solution file and simply changing the query type to a 2.

    Here is a screenshot of the pertinent section in the customizations.xml file:

    pastedimage1647530588519v1.png

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