Notifications
Announcements
No record found.
If I change a field value on form by java script then its onchange event is fired after Save. Can We stop onchange event to fire after save??
*This post is locked for comments
Refer this article:
www.relevantcrm.com/.../The-GOTCHAS-of-the-setSubmitMode-function-AutoSave-in-CRM-2013.aspx
Hi have added this code on save
function submitReadOnlyAttributes() {
Xrm.Page.data.entity.attributes.forEach(function (attribute, index) {
var field = attribute.getName();
if (Xrm.Page.getAttribute(field).getIsDirty() == true) {
Xrm.Page.getAttribute(field).setSubmitMode("always");
} else {
Xrm.Page.getAttribute(field).setSubmitMode("dirty");
}
});
but still on change event fired after save.
You may put below lines to overwrite existing funcationality of your control.
var cntr=Xrm.Page.getControl("<your control Id>");
cntr.setAttribute("onchange", function(){});
I cannot overwrite the existing functionality.
Suppose I have 2 fields and on-change of field 1 I populate the field 2 value. Field 2 also have the on-change function which is supposed to do something. When I save the form after save Field 2 event fire.
How I stop this running after save and why this is running after save???
Hi Ankit
I am also experiencing this same issue where a fields OnChange event is fired after Save if the field value is dirty(Turbo Forms). Did you manage to resolve this?
ThanksSukh
In my case the issue was with Guid which I was using in JS to set lookup value. From 2015 Update1 lookup Guid is case sensitive. So if you are using js to set lookups then use the function below:
function SetLookupValue(LookupId, Type, Id, Name) { if (Id.indexOf('{') == -1) Id = '{' + Id; if (Id.indexOf('}') == -1) Id = Id + '}'; Id = Id.toUpperCase(); var lookupReference = []; lookupReference[0] = {}; lookupReference[0].id = Id; lookupReference[0].entityType = Type; lookupReference[0].name = Name; Xrm.Page.getAttribute(LookupId).setValue(lookupReference); }
and this will solve the issue.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2