gpt4 book ai didi

javascript - Dynamics CRM 2015 中的事件记录通过 FetchXML 查询在子网格中返回 - 主题超链接打开新事件

转载 作者:行者123 更新时间:2023-12-02 14:55:05 28 4
gpt4 key购买 nike

我正在尝试在 Dynamics CRM 2015 中的联系人实体的表单上创建子网格,该子网格返回所有电子邮件、任务、约会和电话事件,其中事件与已加载表单的联系人相关,或者其中该联系人是事件的参与者(即在电子邮件的发件人或收件人/抄送/密件抄送字段中,或在约会的与会者列表中)。

我已在我的联系表单中添加了一个新的子网格(目前称为“NewActivities”),该子网格使用我创建的特定事件 View (并且设计标准“永远”不会返回任何结果 - DateCreated >= 01/01/2050),然后创建了一个 javascript 函数,我已将其作为 Web 资源包含在我的解决方案中,并在表单的 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();

}

希望上述内容有意义,我返回的属性与我设置的子网格中使用的事件 View 的属性相匹配,然后过滤我想要的事件类型以及事件方所在的位置页面上的联系人,适用于所有参与类型(我认为这可能是不必要的,但我的 FetchXML 是根据高级查找查询构建的,因此它明确包含了这些值,因为我选择了所有这些值)。

这似乎工作正常,因为当页面加载时,我在子网格中看到了正确的事件列表,但如果我单击列表中任何事件的主题值,我就会进入“新建”该事件的表单,而不是链接到列出的事件。例如,如果我的子网格列表中返回了一封电子邮件,当我单击子网格中该事件的主题列中的值时,它会加载新电子邮件表单,而不是像我一样将我带到该特定电子邮件事件记录。会期望。

谁能告诉我为什么会发生这种情况以及如何解决它?

(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.)

最佳答案

如果我自己没有尝试过..可能完全错过了重点..但是,您的获取中没有“Id”属性..如果它在插件端,则检索到的记录中将没有记录ID ..尝试添加activitypointerid(或者它是那个activityid吗?)

关于javascript - Dynamics CRM 2015 中的事件记录通过 FetchXML 查询在子网格中返回 - 主题超链接打开新事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35869585/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com