Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

can a field be created to only reflect a YEAR and not a month and year?

  • 1.  can a field be created to only reflect a YEAR and not a month and year?

    TOP CONTRIBUTOR
    Posted 30 days ago
    Is there a way to create a field to only show a YEAR? ex: Year business started. I wanted to show a calendar where user can just select a YEAR only. I suppose I can just create a text box for this but wanted to ask.

    ------------------------------
    Heather L
    ------------------------------


  • 2.  RE: can a field be created to only reflect a YEAR and not a month and year?

    TOP CONTRIBUTOR
    Posted 30 days ago
    I can't really envisage what a calendar control would look like where you can only pick the year - to me this is just a simple numeric field with some useful minimum & maximum values applied.

    If you need it to be a date field rather than a number field, there is a PCF control available that just shows a number field for you to enter the year - https://pcf.gallery/year-picker/.

    ------------------------------
    Mark Carrington
    Chief Technologist
    Data8
    Chester
    ------------------------------



  • 3.  RE: can a field be created to only reflect a YEAR and not a month and year?

    TOP CONTRIBUTOR
    Posted 30 days ago
    yes- that year picker would be awesome to replicate. How do I get to this option?

    thanks

    ------------------------------
    Heather L
    ------------------------------



  • 4.  RE: can a field be created to only reflect a YEAR and not a month and year?

    TOP CONTRIBUTOR
    Posted 30 days ago
    It doesn't seem to have a ready-built managed solution for you to install, so you'd have to build it from the source code in GitHub. Pinging the author @Magnus Gether Sørensen to see if he's got a ​managed solution he can make available?

    ------------------------------
    Mark Carrington
    Chief Technologist
    Data8
    Chester
    ------------------------------



  • 5.  RE: can a field be created to only reflect a YEAR and not a month and year?

    SILVER CONTRIBUTOR
    Posted 30 days ago
    The number field could work well. Only thing is it may show commas unless personalized settings are adjusted. Even then, all whole numbers will be missing commas.

    ------------------------------
    Rodrick Hales
    ------------------------------



  • 6.  RE: can a field be created to only reflect a YEAR and not a month and year?

    SILVER CONTRIBUTOR
    Posted 29 days ago
    Edited by William Zukas 29 days ago
    Just a suggestion, accept the date as-is, then create an onchange function call from that field to convert it to a string then extract only the year.

    var d = new Date(); //get the value of the field entered (I believe this example I copied gets the current date).
    var n = d.toString(); //convert the date to a string
    var yr = n.substr(?4); //where ? = starting position of the year in var n

    ------------------------------
    William Zukas
    Sr. CRM BA/Administrator
    Qosina Corp
    Ronkonkoma NY
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role