
Hello,
I am a newbee with Javascript coding.
I want to hide different form tabs based on a calculated text field. My code doesn't seem to work. Can someone help me?
Here's my code:
function changeTab(executionContext)
{
var formContext = executionContext.getFormContext();
var accountclass = formContext.getAttribute("gs_accountclass").getValue();
var tabObj = formContext.ui.tabs.get("agreement");
var tabObj2 = formContext.ui.tabs.get("quotes");
tabObj.setVisible(false);
tabObj2.setVisible(false);
if (accountclass == "Class1")
{
tabObj.setVisible(true);
tabObj2.setVisible(true);
}
else if (accountclass == "Class2"){
tabObj.setVisible(false);
tabObj2.setVisible(true);
}
else if (accountclass == "Class3"){
tabObj.setVisible(false);
tabObj2.setVisible(true);
}
}
Hi,
Have you selected below highlighetd checkbox while registering the event?
I have used your same code and registered on onchange of Account Class field and form onload , it seems to be working on my instance
I did notice one thing - In class2 and Class3 you are doing same thing - Hiding Agreement tab and shoing Quotes tab
is this expected?
Also, please add your code on form onload.
I hope you have added your Calculated field on Form.
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/