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)

Personal View And/or entity issue

(0) ShareShare
ReportReport
Posted on by 410

I am trying to create a personal view which will show My Open Opportunities AND any opportunities that I follow. The issue I am having in the 2015 CRM webportal is that the setup I have below in the picture makes it so that the results will show 'My Open Opportunities' WHICH ARE ALSO 'Opportunities I follow' -- not what I want.

I.e. The opportunity results that appear in the view need to fit both the criteria of being my open opportunity AND I follow it. Instead I want the criteria to be technically an 'or' -- either it is my opportunity OR I follow it.

Personal-View1-edit.png

There is the grouping function, but because these are two separate entities, I am unable to group these criteria to be an "or". It seems the default between two types of entities is 'AND' and not 'OR' with no obvious way to change it.

Anyone know how to make it the OR type I want? Or will that be really tricky?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    flavia.takushi Profile Picture
    on at

    Hi,

    Unfortunately this is a by design behavior of Advanced Find, that is, you can only use ‘Group OR’ with conditions within the same entity.

    For more information, please check:

    community.dynamics.com/.../three-limitations-of-using-advanced-find

  • Verified answer
    Sean K Profile Picture
    1,537 on at

    Hi Hodges,

     

    There actually is a way to achieve what you need since Dynamics CRM 2013. You will need to use the FetchXML Builder plugin for XrmToolBox.

    https://github.com/MscrmTools/XrmToolBox

    http://fxb.xrmtoolbox.com/

    The steps you would take are:

    • Create a view in CRM, I created one called "My Opportunities and Followed Opportunities", in my test CRM system I created 3 Opportunities; Test Opportunity 1, 2 and 3. 1 was owned by me, 2 was owned by someone else but followed by me and 3 was owned by someone else and not followed by me. So I'd expect to see Opportunity 1 and 2 in my view. Make sure your columns are set up the way you want at this stage.
    • Build your FetchXml query and test that it works, so you create your linked entity and in the or clause you specify entityname as the name or alias of the linked entity, the query I used for testing was:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >

    <entity name="opportunity" >

       <attribute name="name" />

       <attribute name="opportunityid" />

       <attribute name="ownerid" />

       <link-entity name="postfollow" from="regardingobjectid" to="opportunityid" alias="pf" link-type="outer" >

         <attribute name="ownerid" />

       </link-entity>

       <filter type="or" >

         <condition attribute="ownerid" operator="eq-userid" />

         <condition entityname="pf" attribute="ownerid" operator="eq-userid" />

       </filter>

    </entity>

    </fetch> 

    • Open the view you created in step 1 in FetchXmlBuilder

    4.-My-Opportunities.png

    2.-Open-View.png

    • Modify the FetchXml with the query you created in step 2
    • Save the query back into CRM from FetchXmlBuilder

    3.-SaveView.png 

    • Now my view shows Opportunities I own, Test Opportunity 1, and Opportunities I follow, Test Opportunity 2. 

    4.-My-Opportunities.png

    Note; the columns specified in your original view must match up with those returned by the FetchXml Query

  • HodgesW Profile Picture
    410 on at

    Thank you! I am almost there. Executing my XML file did retrieve all the opportunities I wanted, however now I am having issues saving the xml file back to the view in crm. It says:

    Attributes-must-be-the-same.png

    So my understanding is that it doesn't like that I have added a new attribute -- which I did under the link-entity name (shown in bold)

    <entity name="opportunity" >
        <attribute name="name" />
        <attribute name="estimatedvalue" />
        <attribute name="estimatedclosedate" />
        <attribute name="parentcontactid" />
        <attribute name="parentaccountid" />
        <attribute name="opportunityid" />
        <attribute name="ics_probabilityuserdefined" />
        <attribute name="ownerid" />
        <attribute name="ics_opportunityid" />
        <attribute name="ics_marketsubsectorid" />
        <order attribute="name" descending="false" />
        <link-entity name="postfollow" from="regardingobjectid" to="opportunityid" link-type="outer" alias="ac" >
          <attribute name="ownerid" />
        </link-entity>
        <filter type="or" >
          <filter type="and" >
            <condition attribute="ownerid" operator="eq-userid" />
            <condition attribute="statecode" operator="eq" value="0" />
          </filter>
          <condition entityname="ac" attribute="ownerid" operator="eq-userid" />
        </filter>
      </entity>
    </fetch>

    My original view code directly from CRM looked like:

      <entity name="opportunity" >
        <attribute name="name" />
        <attribute name="estimatedvalue" />
        <attribute name="estimatedclosedate" />
        <attribute name="parentcontactid" />
        <attribute name="parentaccountid" />
        <attribute name="opportunityid" />
        <attribute name="ics_probabilityuserdefined" />
        <attribute name="ownerid" />
        <attribute name="ics_opportunityid" />
        <attribute name="ics_marketsubsectorid" />
        <order attribute="name" descending="false" />
        <filter type="or" >
          <filter type="and" >
            <condition attribute="ownerid" operator="eq-userid" />
            <condition attribute="statecode" operator="eq" value="0" />
          </filter>
        </filter>
        <link-entity name="postfollow" from="regardingobjectid" to="opportunityid" link-type="outer" alias="ac" >
          <filter type="or" >
            <condition attribute="ownerid" operator="eq-userid" />
          </filter>
        </link-entity>
      </entity>
    </fetch>



    Note how I had to add the condition entity name so that it would appear.

    So the issue again is that it doesn't like that I now have a new attribute (I think) under the 'ac' alias.

    Thanks for all your help!
     

  • Verified answer
    Sean K Profile Picture
    1,537 on at

    Glad your nearly there, I think you should be able to remove that line:

    <attribute name="ownerid" />

    The one you have in bold, that attribute is causing the issue as it wasn't in the original saved view.

  • HodgesW Profile Picture
    410 on at

    Thanks this worked!

  • HodgesW Profile Picture
    410 on at

    One last issue -- So I created this is as a new system view and it does show up under the dropdown menu on the dashboard. However when I go to create a new view, I cannot use that system view I just created as a template.

    Is this because it is now tweaked in a way CRM can't manage natively? Thoughts?

  • Sean K Profile Picture
    1,537 on at

    Hi, Yes, that seems to be one of the limitations.

  • Community Member Profile Picture
    on at

    Hi Team,

    Am having same issue, But here am trying to show the attribute of the linketity (postfollow) in the View. and getting the error message:

       <Message>Could not find relationship for related entity field pf.createdby specified in layoutxml.</Message>

    Kindly help me on this.

    Regards,

    Raheem.

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