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)

How to remove the , (comma) from Whole Number fields?

(0) ShareShare
ReportReport
Posted on by

Does anyone know of a way to remove the comma from Whole Number fields? This relates specifically to when you are using a 4-digit Whole Number field for entering in a Year.

1256.2018_2D00_03_2D00_06_5F00_8_2D00_17_2D00_10.png

I know that you can change the display options on both a system level, and on a personal preference level, and remove the comma separator. However this also removes the comma from currency, and my users are unwilling to accept that as a compromise.

I have looked at switching to a 4-character free text field, and using JS to validate the text in the fields onChange, and deliver an error message when the text is entered in, or if the number does not contain four digits. However, I am having problems with removing the field level notification once the correct data is entered, which will only confuse the users.

Here's the JS I've used for anyone thats interested.

function buildCheck() {

var buildYear = Xrm.Page.getAttribute("ahoy_build_year").getValue();

Xrm.Page.getControl("ahoy_build_year").clearNotification("a");
Xrm.Page.getControl("ahoy_build_year").clearNotification("b");

if(!Number(buildYear)){
Xrm.Page.getControl("ahoy_build_year").setNotification("Please enter valid year","a");
Xrm.Page.getAttribute("ahoy_build_year").setValue("");

} else if(buildYear && buildYear.length != 4) {
Xrm.Page.getControl("ahoy_build_year").setNotification("Please enter a 4-digit number (YYYY)","b");
Xrm.Page.getAttribute("ahoy_build_year").setValue("");
}

}
I have done a heap of googling, and have found that a lot of people have this same problem, but there is no universal way of solving it.
Does anyone know if there is a solution from a third party provider that could get around this?
Thanks in advance for any feedback or advice.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi ,

    First of all for whole Number field there is only global format you need to change and it will change in whole application.

    In this scenario  better to use single line text what you written here.

    Seems you have not put your whole code here .please follow the step-

    //Clear notification

    If ( numeric )

    {

       If (length ==4)

        {

              //Clear notification

              // Set focus to next field.

         }

          Else

         {

               //Set notification

               // Set field null

         }

    }

    Else{

       //Set notification

        // Set field null

    }

    Hope this helps.

  • Community Member Profile Picture
    on at

    Thanks for tip. Will give it a shot later this arvo.

  • awalters Profile Picture
    3,079 on at

    We actually ended up using an entity for years in circumstances where it's a reasonably limited number of years (i.e. anything you'd feel comfortable putting in a drop down).  Hack-y, but so is everything else.  They really need to allow masking for specific fields.  :-(

  • Suggested answer
    Michael Ual Profile Picture
    on at

    This is a bit late, but have you considered using a custom entity for year?  If users can only relate the year but not create new records, you won't have to validate on data entry.  And as another advantage over using a free text field, you can add a second value to your custom entity to track the year as a whole number in addition to the commaless display, which will allow you to perform addition search / sort functions, such as "year > 2013".

  • Suggested answer
    unizap Profile Picture
    on at

    Hi,

    You may also try input masks on Single Line Text Fields for validating the input. See link below.

    docs.microsoft.com/.../additional-controls-for-dynamics-365-for-phones-and-tablets

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