【发布时间】:2015-02-01 06:10:18
【问题描述】:
默认情况下,动态会保存用户为某个实体使用的最后一个表单。如果用户稍后打开相同类型的实体,则动态使用上次使用的表单。
有没有办法强制动态始终使用某种形式?
【问题讨论】:
-
那个在用户设置里面,现在手头没有代码,去查一下
标签: dynamics-crm-2011 dynamics-crm microsoft-dynamics
默认情况下,动态会保存用户为某个实体使用的最后一个表单。如果用户稍后打开相同类型的实体,则动态使用上次使用的表单。
有没有办法强制动态始终使用某种形式?
【问题讨论】:
标签: dynamics-crm-2011 dynamics-crm microsoft-dynamics
According to this MVP's blog 您可以在Post-Retrieve 插件中更新特定所有者和实体的UserEntityUISettings 记录以设置要显示的表单。
您必须获取并更新UserEntityUISettings,它遵守以下条件:
ownerid 等于插件上下文的 UserId
您需要更新lastviewedformxml 属性以设置您希望用户看到的表单。该属性是一个string,它应该具有这种格式:
"<MRUForm><Form Type=\"Main\" Id=\"FORM_GUID_HERE\" /></MRUForm>"
可以从包含实体的任何导出解决方案的customization.xml 中获取表单 GUID。
有一些问题需要注意:
UserEntityUISettings 中没有任何记录,因此如果查询返回 0 条记录,则不应使用 throw。【讨论】:
您需要编写 JavaScript 以在加载时将表单切换为默认(或任何其他)表单。
function switchForm() {
// Get current form's Label
var item = Xrm.Page.ui.formSelector.getCurrentItem();
itemLabel = item.getLabel();
if (itemLabel != "Information")
{
//load Information form
var items = Xrm.Page.ui.formSelector.items.get();
for (var i in items)
{
var form= items[i];
var formId = form.getId();
var formLabel = form.getLabel();
//Check condition either on ID or Label from Form
if (formLabel == "Information")
{
form.navigate();
}
}
}
请检查这些:
【讨论】: