Dynamics CRM Support Blog
Problems configuring the CRM Outlook client? Use the wizard!
CRM Resource Center
FAQ About Technical SupportOnline | On-Premise
FAQ About Billing
Implementation Guide
Microsoft Dynamics CRM Developer Center and SDK
Hi,
I newbie to Dynamics CRM 2011.I'm trying to use a basic javscript ressource to set a value in a form field.
Here is my code :
var tmp = parseInt (crmForm.all.new_nbr_a.value) + parseInt(crmForm.all.new_nbr_b.value);
crmForm.all.new_nbr_total.value= tmp;
The field is well set in my form but when i save my form, the value is not stored.
Do someone can give me a reason of this problem ?
Thanks a lot
you are trying to write ms crm 4.0 code in ms crm 2011, for ms crm 2011 you need to write like below
var tmp = parseInt(Xrm.Page.getAttribute("new_nbr_a").getValue()) +parseInt(Xrm.Page.getAttribute("new_nbr_b").getValue());
Xrm.Page.getAttribute("new_nbr_total").setValue(tmp);
Need help in CRM Contact US | Our Blog | Follow US | Like our Facebook Page | Our Book
Make sure to Vote as Helpful and Mark As Answer ,if you get answer of your question.
it's better to use the new code, but the old one should work at all. Is your field marked as read-only to prevent the users from editing it manually? If that is the case you have to add something like this:
Xrm.Page.getAttribute(“Field Name”).setSubmitMode(“always”);
With that the field can be written from code even if it is read-only.
Thanks a lot.
It's working