title: Fetchxml to get contacts with active opportunities having the current user as owner CRM 2013
body: <p>Goal:  Make a view that can show all Contacts owned by the current user, and any Contacts with an associated opportunity owned by the current user.</p>
  
  <p>Problem:  I don't have a great command of fetchxml or linkentities even after reviewing what I can Google about them.  When I try to build the view using my fetch statement it's not bringing back anything so I assume I've constructed it incorrectly.</p>
  
  <p>Here is the statement I've made so far:</p>
  
  <pre><code>&lt;fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'&gt;
                      &lt;entity name='contact'&gt;
                        //big list of attributes
                        &lt;order attribute='fullname' descending='false' /&gt;
                        &lt;link-entity name='opportunity' from='customerid' to='contactid' alias='aa'&gt;
                         &lt;filter type='and'&gt;
                           &lt;condition attribute='ownerid' operator='eq-userid' /&gt;
                         &lt;/filter&gt;
                        &lt;/link-entity&gt;
                        &lt;filter type='or'&gt;
                          &lt;condition attribute='ownerid' operator='eq-userid' /&gt;
                        &lt;/filter&gt;
                      &lt;/entity&gt;
                  &lt;/fetch&gt;
  </code></pre>
  
  <p>Any tips would appreciated, thanks!</p>