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)

DateTime field: Removing options from Time dropdownlist

(0) ShareShare
ReportReport
Posted on by

Hello, 

In my Phonecall records, I have a field "Due Date", which is a date time field, with the time dropdownlist showing times from 12:00 AM till 11:30 PM. It seems that I will never need to use values from 12:00 AM till 9:00 AM and from 8:00 PM to 11:30 PM Is there a way i can remove these values from the time dropdown using javascript or any other method? 

Thanks, 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    tpeschat Profile Picture
    4,930 on at

    Hi,

    you could try it with this Approach:

    social.microsoft.com/.../hide-option-set-value

    Hth Thomas

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi SB,

    You can hide it dynamically at the time of from loading, Please see the below syntax :

    var control = Xrm.Page.ui.controls.get("fieldname");

    control.removeOption(value);

    value will be your optionset value which you want to remove

    fieldname is the name of your optionset field.

  • Community Member Profile Picture
    on at

    I appreciate your replies, but I think it would need more work. The attribute scheduledend contains multiple controls. One for Date and one for time. How can I access the Time dropdownlist control using javacript?

    I managed to do the following:

    Xrm.Page.getAttribute('scheduledend').controls.forEach(
    function (control, i) {
      if (i==1)
      {
    control.getControlType(); // result is : standard control.getName(); // result is : header_scheduledend
    control.setLabel('Test'); // changes the Time control label to "Test" } } );

    Does this get us any closer to accessing the optionset?

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    There is no supported way of modifying of time control in mentioned way. One thing I see possible is to create own webresource that will replace standard datetime control but that could take a lot of time and I'm not sure that it is worth to develop it.

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