我正在尝试编写一个 JavaScript 来更改“发件人”字段的查找窗口中的默认实体以使用“联系人”实体。现在帐户是默认实体。
这就是我所拥有的:
document.getElementById("from").setAttribute("defaulttype", "2");
var ViewGUID= "a2d479c5-53e3-4c69-addd-802327e67a0d";
Xrm.Page.getControl("from").setDefaultView(ViewGUID);
我实际上是从这个网站的第 34 点获得代码:http://garethtuckercrm.com/2011/03/16/jscript-reference-for-microsoft-dynamics-crm-2011/
我将该函数附加到表单中并发布了解决方案,但它仍然将帐户显示为默认实体。
任何想法都值得赞赏。谢谢。
最佳答案
尝试此代码(适用于 CRM 2011)
document.getElementById("from").setAttribute("defaulttype", "2");
document.getElementById("from").setAttribute("lookuptypenames", "contact:2:Contact");
document.getElementById("from").setAttribute("lookuptypes", "2");
如果您想在应用 viewID 后禁用 View 选择器,请添加此内容
document.getElementById("from").setAttribute("disableViewPicker", "1");
现在意识到您没有很好地指定 CRM 版本,此代码应该在 CRM 2013 中工作
document.getElementById("from_i").setAttribute("defaulttype", "2");
document.getElementById("from_i").setAttribute("lookuptypenames", "contact:2:Contact");
document.getElementById("from_i").setAttribute("lookuptypes", "2");
关于javascript - 更改 PhoneCall 表单中查找窗口中的默认实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29308538/