CRM 2011从ActivityPartySet获取必需和可选的联系人姓名

时间:2011-10-19 22:50:35

标签: dynamics-crm dynamics-crm-4 dynamics-crm-2011 fetchxml

我正在尝试在SSRS for CRM 2011中创建报告,我正在尝试从AppointmentSet获取信息。我能够得到所有期望的必需和可选参加者。我非常确定AppointmentSet链接到ActivityPartySet以供与会者使用。但我不确定。您将如何获得所需的与会者和可选的与会者。这是我到目前为止所做的。

<fetch>
      <entity name="appointment">
        <attribute name="scheduledstart" />
        <link-entity name="systemuser" from="systemuserid" to="ownerid">
            <attribute name="firstname" alias="ownerFirstName" />
            <attribute name="lastname" alias="ownerLastName" />
        </link-entity>
        <link-entity name="contact" from="contactid" to="new_contactperson">
            <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">
        <attribute name="participationtypemask" alias="participationtypemask" />
        </link-entity>
      </entity>
</fetch>

1 个答案:

答案 0 :(得分:0)

我不完全清楚您的要求,但以下代码段将返回可选或必需与会者的完整详细信息,但前提是它们是系统用户记录。如果各方包含其他记录类型,则不会返回任何结果......

<entity name='appointment'>
    <attribute name='subject'/>
    <attribute name='actualend'/>
    <attribute name='actualstart'/>
    <filter type='and'>
        <condition attribute='activityid' operator='eq' value='MyActivityGuid'/>
    </filter>
    <link-entity name='activityparty' from='activityid' to='activityid'>
        <attribute name='partyidname'/>
        <attribute name='participationtypemask'/>
        <attribute name='activityid'/>
        <attribute name='activitypartyid'/>
        <attribute name='addressused'/>         
        <attribute name='participationtypemaskname'/>
        <attribute name='partyid'/>
        <attribute name='partyiddsc'/>
        <attribute name='partyobjecttypecode'/>
        <attribute name='resourcespecid'/>
        <attribute name='resourcespeciddsc'/>
        <attribute name='resourcespecidname'/>
        <attribute name='scheduledend'/>
        <attribute name='scheduledstart'/>
        <filter type='and'/>
        <filter type='or'>
            <condition attribute='participationtypemaskname' operator='eq' value='Optional attendee'/>
            <condition attribute='participationtypemaskname' operator='eq' value='Required attendee'/>
        </filter>
        <link-entity name='systemuser' from='systemuserid' to='partyid'>
            <attribute name='fullname'/>
        </link-entity>
    </link-entity>
</entity>

否则,如果省略link-entity的最终systemuser个节点,则可以看到包含电子邮件地址的addressused属性。即:

<entity name='appointment'>
    <attribute name='subject'/>
    <attribute name='actualend'/>
    <attribute name='actualstart'/>
    <filter type='and'>
        <condition attribute='activityid' operator='eq' value='MyActivityGuid'/>
    </filter>
    <link-entity name='activityparty' from='activityid' to='activityid'>
        <attribute name='partyidname'/>
        <attribute name='participationtypemask'/>
        <attribute name='activityid'/>
        <attribute name='activitypartyid'/>
        <attribute name='addressused'/>         
        <attribute name='participationtypemaskname'/>
        <attribute name='partyid'/>
        <attribute name='partyiddsc'/>
        <attribute name='partyobjecttypecode'/>
        <attribute name='resourcespecid'/>
        <attribute name='resourcespeciddsc'/>
        <attribute name='resourcespecidname'/>
        <attribute name='scheduledend'/>
        <attribute name='scheduledstart'/>
        <filter type='and'/>
        <filter type='or'>
            <condition attribute='participationtypemaskname' operator='eq' value='Optional attendee'/>
            <condition attribute='participationtypemaskname' operator='eq' value='Required attendee'/>
        </filter>
    </link-entity>
</entity>

这有帮助吗?