Skip to main content

Highlight/Visualize Form BPF Required Fields -JS

This was a nifty function I used to highlight required fields for the current BPF stage as a business recommended so the user did not need to expand the BPF but instead the fields would be highlighted with the blue asterisks

HighlightStageRequiredFields = function (executionContext) {
    var formContext = executionContext.getFormContext();
    var activeStage =;
    var steps = activeStage.getSteps();
    steps.forEach(function (step) {
        var attribute = formContext.getAttribute(step.getAttribute());
        if (step.isRequired() && (attribute.getValue() === null ||  attribute.getValue() === false)  ) {
            if (attribute.getRequiredLevel() !== "required") {

Register this on load and on process change to highlight the fields as the BPF moves stages. Pair this with a field or custom PCF control to move stages and you never have to expand the BPF.

Watch out for the ands when copying in line 7.

Charles Osei

Dynamics 365 Consultant @ Hitachi MCSE Business Applications Computer Science – University of Lincoln 2017 Nottingham D365/CRM user group Chapter Leader TDG – Community leader Twitter @charlied3v LinedIn

Leave a Reply