【发布时间】:2013-04-10 07:13:28
【问题描述】:
我正在尝试创建 javascript 来打开一个对话框。
一旦当前记录上名为“new_mstatus”的字段的值等于“非活动”并且用户打算打开此记录,就会打开一个对话框。
function opendialog() {
if(Xrm.Page.ui.getFormType() == 1)
{
Xrm.Page.data.entity.save(null);
return;
}
// If inactive then trigger dialog
if (Xrm.Page.getAttribute("new_mstatus").getValue() == 'Inactive') {
window.open("/" + Xrm.Page.context.getOrgUniqueName() + "/cs/dialog/rundialog.aspx?DialogId=%7b840D55C6-8307-450B-977F-6A9C9844CCE7%7d&EntityName=appointment&ObjectId=" + Xrm.Page.data.entity.getId());
// Set as being displayed so it doesn't trigger again on load
Xrm.Page.getAttribute("new_displayeddialog").setValue(true);
}
}
但它不起作用。甚至没有错误弹出。
有人可以帮我解决这个问题吗?
非常感谢。
【问题讨论】:
-
字段“new_mstatus”是什么类型?
-
你试过在IE中调试吗?然后就可以按照代码一步一步来了。
-
什么在调用你的 opendialog 函数?
-
@GuidoPreite 该字段是具有 3 个值的选项集。潜在的、不活跃的和活跃的。
标签: javascript dialog dynamics-crm-2011 onload-event topendialog