RE: hide and show tab based on condition using fetch xml with liquid template
Howdy,
Here is a basic JavaScript that hides and shows a tab based on the value in a whole number field, but you can change that to meet the conditions you are looking for, just change "DETAILS_TAB" to the name of your tab and "new_wholenumber" to the name of one of the fields you are going to use to check the condition(s). Right now it is set so that if the whole number field is "2" then the field is shown, otherwise it is hidden. Rinse, lather, repeat if you need more than one field for your evaluations:
function hideOrShowTabFromWholeNumberField(executionContext)
{
var formContext = executionContext.getFormContext();
var tabObj = formContext.ui.tabs.get('DETAILS_TAB');
var wholeNumberFieldValue = formContext.getAttribute('new_wholenumber');
tabObj.setVisible(false);
if (wholeNumberFieldValue.getValue() == 2)
{
tabObj.setVisible(true);
}
}
Just make sure to have that function loaded on the page you want to customize and that the function is set to fire "on load" or when the field changes or whatever :)