I want to make all fields non-mandatory when clicked on resolve case button.
Here is the script for it. I am neither getting error nor result. Any help could be appreciated.
function ResolveCase(primaryControl)
{
debugger;
var formContext = primaryControl.getFormContext();
var tabs = formContext.ui.tabs.get();
for(var i in tabs)
{
var tab = tabs[i];
var sections = tab.sections.get();
for(var j in sections)
{
var sectionname=sections[j];
var controls = sectionname.controls.get();
var controlsLength = controls.length;
for (var i = 0; i < controlsLength; i++)
{
var controlType = controls[i].getControlType();
if (controlType != "iframe" && controlType != "webresource" && controlType != "subgrid") {
control.setRequiredLevel("none");
}
}
}
}
}










