【紧急求助】MSCRM 2011 multiple form 脚本控制
-
lundi 3 octobre 2011 20:47
大家好,我有如下一个用户需求: 我有一个Contact Entity, 在这个Contact Entity上有一个picklist(这个picklist有两个值:“学生”和“老师”),同时还有两个自定义的form(“学生视图”和“老师视图”),当这个picklist选“学生”时,当前用户会看到“学生视图”这个form; 当这个picklist选“老师”时,当前用户会看到“老师视图”这个form。 由于是初次接触MSCRM2011,不知道如何可以使用脚本来控制,希望能够得到大家的帮助,先谢谢大家了。
crm4.0学步
Toutes les réponses
-
mercredi 5 octobre 2011 05:48
首先,在Contact表单上,放置IFrame,假设该iframe的名称为iframe1
其次,在Picklist字段的OnChange事件,编写JScript代码,假设Picklist字段的名称为new_type, 那么脚本大致如下:
var type = Xrm.Page.getAttribute("new_type").getText();
if (type == "学生")
{
Xrm.Page.getControl("iframe1").setSrc(<学生视图URL>);
}
else if (type == "老师")
{
Xrm.Page.getControl("iframe1").setSrc(<老师视图URL>);
}
daemon lin -
mercredi 5 octobre 2011 18:42
先谢谢了,可能是我的表达有误,其实我说的两个视图,是指multiple form中自定义的两个form,两个form的名字分别叫做“学生视图”和“老师视图”。
crm4.0学步 -
vendredi 7 octobre 2011 07:29你看一下Xrm.Page.ui.formSelector的navigate()方法
daemon lin -
mardi 11 octobre 2011 09:40
Xrm.Page.getControl("学生视图的表单名称").setVisible(false);
Xrm.Page.getControl("老师视图的表单名称").setVisible(false);
var type = Xrm.Page.getAttribute("new_type").getText();
if (type == "学生")
{
Xrm.Page.getControl("学生视图的表单名称").setVisible(true);
Xrm.Page.getControl("老师视图的表单名称").setVisible(false);
}
else if (type == "老师")
{
Xrm.Page.getControl("老师视图的表单名称").setVisible(true);
Xrm.Page.getControl("老师视图的表单名称").setVisible(false);
}
To find out the dream is true.