Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

remove mandatory field

Posted on by 150

i need a script to remove mandatory field * 

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: remove mandatory field

    Hi,

    you could also achieve it with a business rule if you are not a dev

    Here is an example:

    7245.BusinessRule.PNG

  • Suggested answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: remove mandatory field

    Hi,

    You may need to remove required level of field as below:

    var AddressType = Xrm.Page.data.entity.attributes.get("address1_addresstypecode");

       AddressType.setRequiredLevel("required");

    Hope this helps :)

  • Suggested answer
    Karsten Wirl Profile Picture
    Karsten Wirl 4,477 on at
    RE: remove mandatory field

    Hi.

    To set business required:

    Xrm.Page.getAttribute("new_field").setRequiredLevel("required");

    To set optional:

    Xrm.Page.getAttribute("new_field").setRequiredLevel("none");

    Kind regards,

    Karsten

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: remove mandatory field

    Hello,

    You can use below :

    function abc()

    {

    if (a=b)

    {

    Xrm.Page.getAttribute("new_myfield").setRequiredLevel("none");

    }

    else

    {

    Xrm.Page.getAttribute("new_myfield").setRequiredLevel("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