- Back to Home »
- Automated Save , JavaScript , Microsoft Dynamics , XRM Consultant »
- Automate a Save Event in JavaScript - Dynamics CRM 4.0
Posted by : XRM Consultant
Wednesday, 14 October 2009
I was having a problem with some JavaScript in MS Dynamics CRM 4.0. I had added the function to a form to hide or show a tab that contained a number of options to hide and show navigation options on the left-hand menu. The problem was that when I loaded the form with the tab hidden, any JavaScript on the hidden tab would not work as it had not been loaded with the rest of the form.
To get around this, I needed to save the form, after I had shown it. I found a very very simple piece of JavaScript to automate this and inserted it at the end of my function as shown:
//Hide Or Show Display Options Tab
if (crmForm.all.cit_showhidenavoptions.DataValue == false)
{
//hide the second tab
crmForm.all.tab6Tab.style.display = "none";
crmForm.Save();
}
else {
//show the second tab
crmForm.all.tab6Tab.style.display = "";
crmForm.Save();
}
Simplest ones are definately the best
Hope this helps
xRM Consultant