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.

  • DynDev1855 Profile Picture
    DynDev1855 5 on at
    RE: Resco (woodford) - Clear OptionSet field's value

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

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

    Thank you!

  • Verified answer
    Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Resco (woodford) - Clear OptionSet field's value

    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
    DynDev1855 5 on at
    RE: Resco (woodford) - Clear OptionSet field's value

    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?

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Resco (woodford) - Clear OptionSet field's value

    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?

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

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

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans