保存由 OnSave 事件触发的字段更新
我正在定制我们的 CRM 解决方案,但今天遇到了问题。我有一个由 OnSave 事件触发的 JavaScript。此 JavaScript 更新表单中的字段,并尝试再次保存。
当脚本执行时,我可以看到我尝试更新的字段发生变化,但是当表单重新加载时,该字段仍然具有其旧值。我在下面放置了一些 sudo 代码。还有其他人遇到过这个问题吗?
保存时
//Update field
Xrm.Page.getAttribute("fieldname").setValue(value);
//Set submit mode to always
Xrm.Page.getAttribute.setSubmitMode("always");
//Force save
Xrm.Page.data.entity.save();
I'm in the process of customizing our CRM solution, but I've run into a problem today. I have a JavaScript that is triggered by the OnSave event. This JavaScript updates a field in the form, and tries to save again.
When the script executes, I can see the field I'm trying to update change, but when the form reloads, that field still has its old value. I've put a little bit of sudo code below. Has any one else ever had this problem?
OnSave
//Update field
Xrm.Page.getAttribute("fieldname").setValue(value);
//Set submit mode to always
Xrm.Page.getAttribute.setSubmitMode("always");
//Force save
Xrm.Page.data.entity.save();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您发布的代码没有复制/粘贴错误,我认为这一行会导致您的问题
这应该是
If your posted code has no copy/paste errors, I think this line causes your problem
This should be
我的回答是没有答案,更多的是呼救自己。对不起。
正如我在中所述,我将检查设置提交模式和更改值的顺序。看来您必须先设置提交模式,然后分配一个值。
现在我的更改已保存。
My answer was no answer more of a cry for help it self. Sorry.
As I stated in I would check the order of setting de submitmode and changing of the value. As it appears you must set the submitmode first and then assign a value.
Now my changes are saved.