Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Mark field Not Required on BPF

Posted on by 104

Hi,

How can we mark field not Required (optional) on BPF using JavaScript ?

I tried below, but it is not working for me.

 formContext.getAttribute("header_process_cri_productregistrationid").setRequiredLevel("none");
 
here, 
"header_process_cri_productregistrationid" is the schema name of the field.
Thanks in advance 
  • Suggested answer
    RE: Mark field Not Required on BPF

    Hi, here you can find the answer you are looking for:

    Set BPF Fields Required/Not Required using javascript - Microsoft Dynamics CRM Forum Community Forum

    If this was helpful, please check it as verified to help others finding useful information.

    Welcome to this amazing community.

  • Verified answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: Mark field Not Required on BPF

    Hi,

    Please try below steps:

    1. De-select the required checkbox from field of BPF as shown below:

    pastedimage1633632061566v1.png

    2. Now add logic in script make field required and not required using below syntax:

    formContext.getControl('header_process_<logical name of field>').getAttribute().setRequiredLevel('<none/recommended/required>');
    e.g.

     let formContext=executionContext.getFormContext();
    
    
        if(formContext != undefined)
        {
            let bpfControl=formContext.getControl('header_process_parentcontactid');
            if(bpfControl != undefined)
            {
                let attribute=bpfControl.getAttribute();
                if(attribute != undefined)
                {
                    attribute.setRequiredLevel("none");
                }
            }
        }

    We need to add both logic in script to handle required level of field. 

    Thanks,
    Pradeep.

    Please mark this as VERIFIED. If it helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans