// executionContext is passed as function parameter var formContext = executionContext.getFormContext(); // Set field as required formContext.getAttribute("fieldname").setRequiredLevel("required"); // Set field as recommended formContext.getAttribute("fieldname").setRequiredLevel("recommended"); // Set field as optional formContext.getAttribute("fieldname").setRequiredLevel("none");