2011-12-06 7 views
0

CRM 2011で設定された予定を照会するために、以下のコードを使用しています。このクエリを使用すると、データが返されますが、重複が返されます。外部結合を取り出すと、何も返されません。どのようにこれを修正するための任意のアイデア?外部入札のあるCRM 2011のクエリ

<fetch> 
    <entity name="appointment"> 
    <attribute name="scheduledstart" /> 
    <link-entity name="systemuser" from="systemuserid" to="ownerid" link-type="outer"> 
     <attribute name="firstname" alias="ownerFirstName" /> 
     <attribute name="lastname" alias="ownerLastName" /> 
    </link-entity> 
    <link-entity name="contact" from="contactid" to="new_contactperson" link-type="outer"> 
     <attribute name="parentcustomerid" alias="parentaccount" /> 
     <attribute name="new_businessunit" alias="businessunit" /> 
    </link-entity> 
    <attribute name="new_contactperson" /> 
    <attribute name="subject" /> 
    <attribute name="new_coldernotes" /> 
    <link-entity name="activityparty" from="activityid" to="activityid" link-type="outer"> 
     <attribute name="participationtypemask" alias="participationtypemask" /> 
     <filter> 
     <condition attribute="participationtypemask" operator="eq" value="5" /> 
     </filter> 
     <link-entity name="contact" from="contactid" to="partyid" link-type="outer"> 
     <attribute name="fullname" alias="RequiredContactFullName" /> 
     </link-entity> 
     <link-entity name="systemuser" from="systemuserid" to="partyid" link-type="outer"> 
     <attribute name="fullname" alias="RequiredOwners" /> 
     </link-entity> 
     <link-entity name="account" from="accountid" to="partyid" link-type="outer"> 
     <attribute name="name" alias="RequiredAccount" /> 
     </link-entity> 
    </link-entity> 
    <!--the new join--> 
    <link-entity name="activityparty" from="activityid" to="activityid" alias="optionalactivityparty" link-type="outer"> 
     <attribute name="participationtypemask" alias="optionalparticipationtypemask" /> 
     <filter> 
     <condition attribute="participationtypemask" operator="eq" value="6" /> 
     </filter> 
     <link-entity name="contact" from="contactid" to="partyid" alias="optionalcontact" link-type="outer"> 
     <attribute name="fullname" alias="OptionalContactFullName" /> 
     </link-entity> 
     <link-entity name="systemuser" from="systemuserid" to="partyid" alias="systemuser2" link-type="outer"> 
     <attribute name="fullname" alias="OptionalOwners" /> 
     </link-entity> 
     <link-entity name="account" from="accountid" to="partyid" alias="optionalaccount" link-type="outer"> 
     <attribute name="name" alias="OptionalAccount" /> 
     </link-entity> 
    </link-entity> 
    <filter type="and"> 
     <condition attribute="scheduledstart" operator="on-or-after" value="@FromDate" /> 
     <condition attribute="scheduledstart" operator="on-or-before" value="@ToDate" /> 
    </filter> 
    </entity> 
</fetch> 

ありがとう!

答えて

4

はあなたのルートが

<fetch distinct='true'> 
... 
</fetch> 
にノードをフェッチ変えることによって設定された個別のレコードをしたいことを示して試してみてください