Skip to main content

Notifications

Announcements

No record found.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans