web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Resco (woodford) - Clear OptionSet field's value

(0) ShareShare
ReportReport
Posted on by 5

Hello,

How can I clear the value of option set field in woodford (resco) in script? (onLoad, onChange, onSave)

I know how to clear non option-set values (for example string, int etc...) 

Step -> Entity.[some_field].Clear

pastedimage1601550457752v1.png

But when I try to clear an option set value, I can't see such an option. I can only set 'Assign':

pastedimage1601550492684v2.png

And in 'Assign' I see only 'Active', 'Inactive'. Can't see 'null' or something like that.

Thank you in advance.

I have the same question (0)
  • Thomas David Dayman Profile Picture
    11,323 on at

    I dont think you can clear a statecode field? Either the record is active or inactive.

    But you clear a custom optionset field and assign it as (Empty)

    What are you trying to achieve exactly?

  • DynDev1855 Profile Picture
    5 on at

    The statecode field was only an example. It can be whatever custom field, but it needs to be option set.

    So for example let's say I have a field:

    new_testOptionSetField

    Type: OptionSet

    Values: Test1, Test2, Test3

    What I want to achieve - I want to clear this value onSave (so when I save the form, I want to have value of this field cleared (set to null))

    I can do this by javascript doing this:
    Xrm.Page.getAttribute("new_testOptionSetField).setValue(null)

    How to do this in woodford?

  • Verified answer
    Thomas David Dayman Profile Picture
    11,323 on at

    So what I noticed is that if you have Default value as 'Unassigned Value' then you will get the option to assign as (Empty) in Woodford

    2783.Screenshot_5F00_1.png

    4863.Screenshot_5F00_2.png

    But if you want to do it in code then (I think) the bottom code should be fine

    entityForm.entity.properties["fieldname"] = null;

  • DynDev1855 Profile Picture
    5 on at

    Setting default value to 'Unassigned Value' made it possible. 

    Didn't check your code tho, didn't need to do so.

    Thank you!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 55 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 25 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans