Get formcontext from execution Context
var formContext = executionContext.getFormContext();
Show/Hide field
//Show
formContext.getControl("fieldname").setVisible(true);
//Hide
formContext.getControl("fieldname").setVisible(false);
Set requirement level
//required
formContext.getAttribute("fieldname").setRequiredLevel("required");
//recommended
formContext.getAttribute("fieldname").setRequiredLevel("recommended");
//Optional
formContext.getAttribute("fieldname").setRequiredLevel("none");
Set enable/disable field
//Disbale
formContext.getControl("fieldname").setDisabled(true);
// Set field enable
formContext.getControl("fieldname").setDisabled(false);
Show/Hide tab
//show tab
var tab1 = formContext.ui.tabs.get("tabname");
tab1.setVisible(true);
// Hide tab
var tab2 = formContext.ui.tabs.get("tabname");
tab2.setVisible(false);