Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

V9 Dynamics 365 JavaScript to re-select "Unassigned Value" as currently set optionset value on form?

(0) ShareShare
ReportReport
Posted on by 1,583

I have an entity, entityX and it has an option set with 3 possible values (Interior, Exterior, or Both)

The default option set value is set to Unassigned Value on the Internal/External Field shown circled in black on the leftmost part of the image below. 

Under certain circumstances, I need to be able to set this field selected value back to Unassigned Value so neither of the 3 options are selected and the field looks exactly as it does below on the leftmost part of the image. 

What is the JavaScript command I can use to do this?

The following command doesn't work  Xrm.Page.data.entity.attributes.get(typeMultiOption).setValue(null);

Does anyone know or can anyone advise me as to what command will set this back to Unassigned Value so it looks like it does in the image below circled in black on the left?

8154.OptionSet.png

*This post is locked for comments

  • Verified answer
    ACECORP Profile Picture
    ACECORP 1,583 on at
    RE: V9 Dynamics 365 JavaScript to re-select "Unassigned Value" as currently set optionset value on form?

    I was able to solve this problem using the following V9 JavaScript Code:

     var formContext = executionContext.getFormContext();
                            formContext.data.entity.attributes.get(typeMultiOption).setValue(null);
                            formContext.getAttribute(nameField).setValue(null);
                            formContext.data.refresh();


    Problem solved!

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,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans