Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Reset field value to the default optionset option with Javascript

(0) ShareShare
ReportReport
Posted on by

In my quote form, I have a series of fields in a section that I need to clear based on an onChange event elsewhere on the form. For the most part, I have everything all ironed out, but I would like a few of the optionset fields to revert to the default value instead of getting set to null. Is there a way to set those to the default value without having to explicitly declare the default value for each field?

*This post is locked for comments

  • AnujGovil Profile Picture
    AnujGovil 10 on at
    RE: Reset field value to the default optionset option with Javascript

    Hi Aric Levin Thank you for your fix. It worked for me.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Reset field value to the default optionset option with Javascript

    Application Tag says Dynamics CRM Online, not CRM On-Premise 2013.

  • Prashnat Verma Profile Picture
    Prashnat Verma 287 on at
    RE: Reset field value to the default optionset option with Javascript

    Hi Aric ,

    Thats not working in crm 2013.

    thanks

  • TNS Profile Picture
    TNS 1,195 on at
    RE: Reset field value to the default optionset option with Javascript

    Yeah , business rule can be triggered at on change of any field... depending at which scope you are triggering the business rule..

    like if you have two fields a & b ... and you have put a business rule on field 'b ' that if value of a = x then value of b = y ..... and scope of rule is entity ... so on change of a value of b also change...

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Reset field value to the default optionset option with Javascript

    I think you might be able to get that value by using the getInitialValue method

    var defaultValue = Xrm.Page.getAttribute(osName).getInitialValue();

    Xrm.Page.getAttribute(osName).setValue(defaultValue);

    Hope this helps.

  • RE: Reset field value to the default optionset option with Javascript

    You can't have a business rule trigger onChange though, can you?

  • TNS Profile Picture
    TNS 1,195 on at
    RE: Reset field value to the default optionset option with Javascript

    Hi,

    You can create business rules .. depending on any condition.

    Thanks!

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans