Dynamics 365 — Hide/Disable/Edit Business Process Flow Fields using JavaScript

Furkan Karacan
1 min readNov 18, 2022

--

In Dynamics 365, Business Process Flow attributes are just like Form attributes. You can use most of the controls in the same way as you normally do for Form attributes. Let’s look at the most common ones together.

Get Business Process Flow attribute control using Javascript

To get attributes Add “header_process” before schema name of field. Lets say your attribute schema name is “cm_myattribute”.

function BpfControls(executionContext) {
var formContext = executionContext.getFormContext();
var bpfControl = formContext.getControl('header_process_cm_myattribute');
var attribute = bpfControl.getAttribute();
}

Set attribute value for Business Process Flow using Javascript

function BpfControls(executionContext) {
var formContext = executionContext.getFormContext();
var bpfControl = formContext.getControl('header_process_cm_myattribute');
var bpfAttribute = bpfControl.getAttribute();

if (bpfAttribute != undefined) {
bpfAttribute.setValue("myValue");
}
}

Hide field in a Business Process Flow using Javascript

function BpfControls(executionContext) {
var formContext = executionContext.getFormContext();
var bpfControl = formContext.getControl('header_process_cm_myattribute');

bpfControl("header_process_cm_myattribute").setVisible(false);
}

Set field Required in a Business Process Flow using Javascript

function BpfControls(executionContext) {
var formContext = executionContext.getFormContext();
var bpfControl = formContext.getControl('header_process_cm_myattribute');
var bpfAttribute = bpfControl.getAttribute();

if (bpfAttribute != undefined) {
attribute.bpfAttribute("required");
}
}

--

--