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 :
Microsoft Dynamics CRM (Archived)

Field value always disappears when I click Save and/or Save and Close button

(0) ShareShare
ReportReport
Posted on by 26

I am in an entity (form), and there is a field that I have marked required.  When I select from the option set and hit Save the value that I selected in this required field disappears and then I have to select it again.  It is only happening to this one field, not sure why.  I have tried removing this field from the form, publishing the changes, reading the field back in, publishing the changes and it is still an issue.  When I open an existing record and change this required field and click save, it saves it just fine and keeps the value in the field. 

Any help is appreciated.

*This post is locked for comments

I have the same question (0)
  • Aiden Kaskela Profile Picture
    19,696 on at

    Hi,

    What kind of field is it? Does the same thing happen if you click elsewhere on the form and then hit save?

    Thanks,

     Aiden

  • USA80 Profile Picture
    26 on at

    It is a required field and is a drop down.  It doesn't matter where I am on the form when I click save it happens.  Does that help?

  • Aiden Kaskela Profile Picture
    19,696 on at

    I was hoping it wasn't a drop down - they've always been pretty reliable for me. Do you have any custom scripts or business rules on that entity? Anything that could be causing the errant behavior?

    Thanks,

     Aiden

  • USA80 Profile Picture
    26 on at

    There is java script under Events tab, Form Libraries, this is for what to show in the required field based on what is selected in a different field.  No Business rules.

  • Aiden Kaskela Profile Picture
    19,696 on at

    So that javascript is dynamically populating values in the dropdown?

  • USA80 Profile Picture
    26 on at

    yes

  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    My guess is that your drop down has not options in the customizations. Check out the documentation on adding values here: https://msdn.microsoft.com/en-us/library/gg334266.aspx#BKMK_options


    This method doesn’t check that the values in the options you add are valid. If you add invalid options they will not work correctly. You must only add options that have been defined for the specific option set attribute that the control is bound to. Use the attribute getOptions or getOption methods to get valid option objects to add using this method.

    I believe what it's saying is that you can't have a blank option set, and on the form have js that adds 1, 2, and 3. It won't work. The methods are designed so your option set has valid values in the customizations, and you manipulate that list.

    To get your drop down working, try this:

    1. Edit your options and add as many as your highest number of dynamic fields (i.e., if there can be up to 10 items, add 10 option set options). When the form loads, there will be X valid options.
    2. When the form loads, call clearOptions to wipe out the values. This will give you an empty-looking drop down.
    3. When your javascript populates the drop down values, make sure the items you add matches a valid value.

    If you do that, you should have valid values in the drop down and it'll stay populated when you click save.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

    Aiden

  • USA80 Profile Picture
    26 on at

    So you are saying to not make this a global option set, but to now make this an option set field and list out all of the options.  Then have a java script that run on load, to clear the options form this field...is that correct?

  • Aiden Kaskela Profile Picture
    19,696 on at

    From reading that documentation, it looks like you can only use the addOption method if you're adding valid values. In order to get that, you need to have valid values in the metadata that correspond with what your code is doing. I don't think it matters if it's a global option set or not, merely that the options in the drop down when you click 'Save' are valid as far as the metadata is concerned.

  • USA80 Profile Picture
    26 on at

    The strange thing is that even know the field value goes away when save is clicked, if I then just leave the page and go back to the form, my record is there with my value yet.  So it appears it still saves the value, but on the screen it acts like it removes it and wants you to enter it again

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans