【问题标题】:Adding a label to crm 2011 form向 crm 2011 表单添加标签
【发布时间】:2014-02-06 11:18:56
【问题描述】:
我想向 crm 2011 添加一个标签,该标签显示表单上具有特定样式的一个可用属性的值。我打算这样做如下
- 将 iframe 添加为 Web 资源。
- 现在一旦表单加载完成,编辑 iframe 的源属性并将值作为查询字符串参数附加到它。
3.之后访问html网络资源中的查询字符串参数并将其设置在标签上。
现在我的问题是:
我可以在 iframe 内使用普通的 javacript (document.getElementById ...) 来设置标签吗?我知道不支持在 CRM 2011 表单中解析 DOM。在 iframe 内也不支持吗?
【问题讨论】:
标签:
iframe
dynamics-crm-2011
【解决方案1】:
您可以像在表单自定义中一样通过parent.Xrm 访问表单,因此您可以构建如下脚本:
// example: grab the "name" field from the form
// this will only work from inside an IFRAME in the form, of course
function getName() {
var attr = parent.Xrm.Page.getAttribute('name');
if(attr !== null)
return attr.getValue();
else
return null;
}
【解决方案2】:
在 WebResource 中,您可以使用普通的 javascript,但您可以自行决定使其与您想要支持的所有浏览器兼容。