简体   繁体   English

FetchXML查询在子网格中返回的Dynamics CRM 2015中的活动记录-主题超链接打开新的活动

[英]Activity records in Dynamics CRM 2015 returned in subgrid by FetchXML query - Subject hyperlink opens new Activity

I am trying to create a subgrid on a Form for the Contact Entity in Dynamics CRM 2015 which returns all Email, Task, Appointment and Phone Call Activities where either the Activity is Regarding the Contact for which the Form has been loaded, or where that Contact is a participant in the Activity (ie in the Sender or To/CC/BCC fields for an email, or on the attendee list for an Appointment). 我正在尝试在Dynamics CRM 2015中的联系人实体的表单上创建一个子网格,该子网格将返回所有电子邮件,任务,约会和电话活动,其中该活动与已加载表单的联系人有关,或者该联系人是“活动”的参与者(即电子邮件的“发件人”或“收件人/抄送/密件抄送”字段,或约会的参与者列表中的参与者)。

I have added a new subgrid (called "NewActivities" for now) to my Contact Form which uses a specific Activity View which I have created (and is designed with criteria that will "never" return any results - DateCreated >= 01/01/2050) and then created a javascript function which I have included as a Web Resource in my Solution and am calling in the OnLoad event of the Form: 我已经在我的联系表单中添加了一个新的子网格(现在称为“ NewActivities”),该子网格使用了我创建的特定活动视图(其设计条件是“绝不会”返回任何结果-DateCreated> = 01/01 / 2050),然后创建了一个javascript函数,该函数已作为Web资源包含在我的解决方案中,并正在调用Form的OnLoad事件:

 function DisplaySubGrid() { var subgrid = document.getElementById("NewActivities"); if (subgrid == null) { setTimeout('DisplaySubGrid()', 1000); return; } var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" + "<entity name='activitypointer'>" + "<attribute name='activitytypecode' />" + "<attribute name='subject' />" + "<attribute name='statecode' />" + "<attribute name='regardingobjectid' />" + "<attribute name='ownerid' />" + "<attribute name='scheduledend' />" + "<attribute name='createdby' />" + "<attribute name='createdon' />" + "<order attribute='scheduledend' descending='false' />" + "<order attribute='subject' descending='false' />" + "<filter type='and'>" + "<condition attribute='activitytypecode' operator='in'>" + "<value>4201</value>" + "<value>4202</value>" + "<value>4210</value>" + "<value>4212</value>" + "</condition>" + "</filter>" + "<link-entity name='activityparty' from='activityid' to='activityid' alias='ae'>" + "<filter type='and'>" + "<condition attribute='participationtypemask' operator='in'>" + "<value>4</value>" + "<value>3</value>" + "<value>11</value>" + "<value>6</value>" + "<value>7</value>" + "<value>9</value>" + "<value>8</value>" + "<value>5</value>" + "<value>10</value>" + "<value>1</value>" + "<value>2</value>" + "</condition>" + "<condition attribute='partyid' operator='eq' uiname='" + Xrm.Page.getAttribute("fullname").getValue() + "' uitype='contact' value='" + Xrm.Page.data.entity.getId() + "' />" + "</filter>" + "</link-entity>" + "</entity>" + "</fetch>" subgrid.control.SetParameter("fetchXml", fetchXml); subgrid.control.refresh(); } 

Hopefully the above makes sense, I'm returning attributes which match those of the Activity View which is being used in the subgrid I've set up and then filtering for the Activity Types I want and just where the Activity Party is the Contact on the page, for all participation types (this may be unnecessary I suppose, but my FetchXML was built from an Advanced Find query, so it explicitly included the values because I selected all of them). 希望以上所述是有道理的,我将返回与在已设置的子网格中使用的“活动视图”的属性匹配的属性,然后过滤所需的活动类型,以及“活动方”是页面,适用于所有参与类型(我想这可能是不必要的,但是我的FetchXML是从“高级查找”查询中构建的,因此由于我选择了所有值,因此它明确包含了值)。

This seems to work fine in that I see the correct list of Activities in my subgrid when the page loads, but if I click on the Subject value of any of the Activities in the list, I am taken to the "New" Form for that Activity instead of linking to the Activity that was listed. 这似乎很好用,因为在页面加载时,我在子网格中看到了正确的“活动”列表,但是如果我单击列表中任何“活动”的“主题”值,则会进入“新”表单活动,而不是链接到列出的活动。 So for example, if there is an Email in my subgrid list returned, when I click on the value in the Subject column for that Activity in the subgrid, it loads the New Email form instead of taking me to that specific Email Activity record as I would expect. 因此,例如,如果返回了我的子网格列表中的电子邮件,则当我单击子网格中该活动的“主题”列中的值时,它将加载“新电子邮件”表单,而不是像我一样将我带到该特定的电子邮件活动记录会期望的。

Can anyone advise why this is happening and how I can resolve it? 谁能告诉我为什么会这样以及我如何解决呢?

(I do also have an additional problem, whereby sometimes when navigating to this Contact Form, the subgrid does not always refresh - even though my javascript is definitely running - and so the subgrid shows no Activity records. If I refresh the subgrid manually after page load, the results are shown - I don't understand why this is happening either. It seems to be when navigating away from the Contact Form and then using the Back in my browser to return, but I have also had it happen on a page refresh. Sorry if I'm not meant to include two questions in the same post, I can obviously post this question separately if I need to, but thought it worth mentioning as it relates to the exact same functionality I'm trying to implement.) (我还有一个额外的问题,即有时导航到此联系表单时,即使我的JavaScript确实正在运行,子网格也不会始终刷新-因此该子网格不会显示活动记录。如果我在页面后手动刷新该子网格,加载时,将显示结果-我也不明白为什么会这样,似乎是在离开联系表单,然后在浏览器中使用“后退”返回时,但我也曾在页面上发生过这种情况抱歉,如果我不打算在同一篇文章中包含两个问题,显然可以根据需要单独发布此问题,但值得一提,因为它与我要实现的功能完全相同。 )

不用自己尝试..可能只是完全忽略了重点..但是,您的提取中没有'Id'属性。.如果它在插件端,则检索到的记录中将没有记录ID。添加activitypointerid(或者它是那个的activityid吗?)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 动态CRM。 在subgrid中完全自定义FetchXml - Dynamics CRM. Fully custom FetchXml in subgrid Dynamics CRM 2011 - 从主网格打开自定义活动会打开“新记录”窗口 - Dynamics CRM 2011 - opening custom activity from main grid opens “new record” window instead 使用调用 HTTPRequest 的 FetchXml 查询检索 CRM Dynamics 365 版本 8.2 中的多条记录,但 HTTPRequest 将不起作用 - Retrieve multiple records in CRM Dynamics 365 version 8.2 using FetchXml query calling HTTPRequest but HTTPRequest will not work 设置子网格的fetchXML时,无法读取Dynamics CRM中未定义的属性“ SetParameter” - Cannot read property 'SetParameter' of undefined in Dynamics CRM while setting up fetchXML of a subgrid Dynamics CRM 2015 Online:SubGrid 的 control.SetParameter 方法不可用 - Dynamics CRM 2015 Online: SubGrid's control.SetParameter method is not available dynamics crm在关联的视图上获取子网格的名称 - dynamics crm get name of subgrid on associated view 如何以Dynamics CRM形式调整子网格的高度? - How to resize the height of the subgrid in dynamics crm forms? 如何在主题字段中隐藏主题,就像在 MS Dynamics CRM 2015 中隐藏选项集字段中的项目一样? - How can I hide a subject in subject field, just like hiding an item from optionset field in MS Dynamics CRM 2015? CRM Dynamics 2015 IFrame通信 - CRM Dynamics 2015 IFrame Communication 在 Dynamics 365 CRM 统一界面中重新加载/刷新子网格时重新加载表单 - Reload Form on reload/refresh of subgrid in Dynamics 365 CRM Unified Interface
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM