I have an OptionSet whose default value is "Unassigned", which shows as blank to a user browsing the form.
On certain conditions, I have to clear the option set and set its value back to "Unassigned".
Here's the code that I have:
Xrm.Page.Data.Entity.Attributes.Get("fieldName").setValue(null);
That indeed does change the value to "Unassigned" and shows the option set with a blank, but it doesn't seem like this is what gets mitted to the database.
If I run an Advanced Find, I still see the old value that was there prior to running the code above on it.
Anything I'm missing ?
Thanks.
I have an OptionSet whose default value is "Unassigned", which shows as blank to a user browsing the form.
On certain conditions, I have to clear the option set and set its value back to "Unassigned".
Here's the code that I have:
Xrm.Page.Data.Entity.Attributes.Get("fieldName").setValue(null);
That indeed does change the value to "Unassigned" and shows the option set with a blank, but it doesn't seem like this is what gets mitted to the database.
If I run an Advanced Find, I still see the old value that was there prior to running the code above on it.
Anything I'm missing ?
Thanks.
Share Improve this question asked Nov 20, 2013 at 22:07 Francis DucharmeFrancis Ducharme 4,9978 gold badges46 silver badges88 bronze badges 02 Answers
Reset to default 5Try,
Xrm.Page.getAttribute([fieldname]).setSubmitMode("always");
Sometimes when values are changed by script (especially when they are read only) CRM doesn't pick up the change.
Instead of google I would remend starting with this link (which I can't take credit for!):
http://danielcai.blogspot./2011/04/microsoft-dynamics-crm-2011-javascript.html
There is a link to a skydrive document which has a prehensive cheat sheet for all the Xrm Namespace functions. Worth its weight in gold!