Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Set field requirement on all fields in a tab | CRM 2016

Posted on by 260

Hi,

Is there a way to set all fields on a specific tab required based on an option set value using jscript?

Thank you

*This post is locked for comments

  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Set field requirement on all fields in a tab | CRM 2016

    Hi Samuel Kimathi,

    Please try the JS code below.

    function SetBusinessRequired() {
        var optionSetValue = Xrm.Page.getAttribute("optionSetName").getValue();
        if (optionSetValue == 10000000) {       //Check if the option set value is your value
            Xrm.Page.ui.tabs.get("tabName").sections.forEach(function (section, sectionIndex) {
                section.controls.forEach(function (control, index) {
                    control.getAttribute().setRequiredLevel("required");
                });
            });
        }
    }

    Hope this helps.

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Set field requirement on all fields in a tab | CRM 2016

    Hi Samuel,

    This article can help you:

    crmandcoffee.wordpress.com/.../set-as-business-required-all-fields-on-a-tab

  • Mihir@CRM Profile Picture
    Mihir@CRM 4,036 on at
    RE: Set field requirement on all fields in a tab | CRM 2016

    You can do this using business rules or JS.

    With business rules you will need to specify the fields that have to be required.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans