Using Xrm.Page.getAttribute("your field name").getValue() we can retrieve the CRM field value. But there are some scenarios, this line of code will give wrong or old value.
Ex. Write something on Subject field and click immediately on button (Webresource button), on onclick of it, try to retrieve the value of this field. It will not give you the update value. After a couple of hours effort found a way to get the updated value in this scenario.
On button click event change the focus to button click event then save the form. Then try to retrieve the field. It will give you the updated values.
Ex. Write something on Subject field and click immediately on button (Webresource button), on onclick of it, try to retrieve the value of this field. It will not give you the update value. After a couple of hours effort found a way to get the updated value in this scenario.
On button click event change the focus to button click event then save the form. Then try to retrieve the field. It will give you the updated values.
function ButtonClick() { Xrm.Page.ui.controls.get("new_button").setFocus(); window.Xrm.Page.data.entity.save(); Xrm.Page.getAttribute("subject").getValue() }
No comments:
Post a Comment