[英]Dynamics crm 365 quick create form get parent entity data
When I click on the "New" link in a form's lookup field, the quick create form opens.当我单击表单查找字段中的“新建”链接时,会打开快速创建表单。 I need to get values of the parent form to prefill some fields of the quick create form.
我需要获取父表单的值来预填充快速创建表单的某些字段。 This can't be done with mappings (as seen in some posts in this site), since it must only work in the quick create form.
这不能通过映射来完成(如本网站的一些帖子所示),因为它只能在快速创建表单中工作。 How can I do this in javascript?
我怎样才能在 javascript 中做到这一点? There is no other way except using localStorage?
除了使用localStorage就没有其他办法了吗?
EDIT:编辑:
window.parent.Xrm.Page.getAttribute(attribute name).getValue()
does not work不起作用
You have two choices, to achieve this in js.你有两种选择,在 js 中实现这一点。
Either in main form scripting you can assign in a global variable and access it in Quick create form.在主表单脚本中,您可以分配全局变量并在快速创建表单中访问它。 Depends on the version, you may have to manage
formContext
instead of Xrm.Page
.取决于版本,您可能需要管理
formContext
而不是Xrm.Page
。 Read more 阅读更多
var setValsForQuickCreate = function(){ window.top.attributename = Xrm.Page.getAttribute("new_attributename").getValue(); } var setValFromMainForm = function(){ Xrm.Page.getAttribute("new_attributename").setValue(window.top.attributename); }
Otherwise, you can query using the web api on form load, filter it based on parent lookup value mapped and fill the fields.否则,您可以在表单加载时使用 web api 进行查询,根据映射的父查找值对其进行过滤并填充字段。 You can create a separate library/method for registering in QC form only or check only if it is Quick create form and execute it.
您可以创建单独的库/方法仅在 QC 表单中注册或仅检查是否为快速创建表单并执行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.