Operations in Business Process Flow using JavaScript in D365 CRM
Introduction – In this blog, you will learn about how we can perform different operations such as disable, enable, hide, etc. on D365 CRM Business Process flow using JavaScript.
Set value in Business Process Flow
var formContext = executionContext.getFormContext();
let bpfControl = formContext.getControl('header_process_cf_outreach')
let attribute = bpfControl.getAttribute();
if(attribute != undefined)
{
attribute.setValue(979570000);
}
Disable field on Business Process Flow
formContext.getControl("header_process_cf_outreach").setDisabled(true);
here cf_outreach is the schema name of the field on BPF. for BPF we need to write header_process before the schema name of the field
Enable field on Business Process Flow
formContext.getControl("header_process_cf_outreach").setDisabled(false);
Hide a field on Business Process Flow
formContext.getControl("header_process_cf_outreach").setVisible(false);
Mark Field Required on Business Process Flow
var formContext = executionContext.getFormContext();
let bpfControl = formContext.getControl('header_process_cf_outreach');
let attribute = bpfControl.getAttribute();
if(attribute != undefined)
{
attribute.setRequiredLevel("required");
}
Mark Field Optional on Business Process Flow
var formContext = executionContext.getFormContext();
let bpfControl = formContext.getControl('header_process_cf_outreach');
let attribute = bpfControl.getAttribute();
if(attribute != undefined)
{
attribute.setRequiredLevel("none");
}
Mark field recommended on Business Process Flow
var formContext = executionContext.getFormContext();
let bpfControl = formContext.getControl('header_process_cf_outreach');
let attribute = bpfControl.getAttribute();
if(attribute != undefined)
{
attribute.setRequiredLevel("recommended");
}
Related posts:

Resolving SSL/TLS Secure Channel Trust Errors in Dynamics 365 Finance and Operations

How to change a Bill of material (BOM) item on a production order
How to Set Up a Local Development Environment for D365 Finance and Operations Without Azure Costs
![Shopify Meets Dynamics 365 Finance and Operations: A Guide to Integration [Part 2]](https://www.cloudfronts.in/wp-content/uploads/2024/12/DALL·E-2024-12-14-12.29.44-A-professional-illustration-depicting-the-integration-between-Shopify-and-Dynamics-365-Finance-and-Operations.-The-image-shows-Shopify-on-one-side-wit-150x150.webp)
