Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Editing view attribute properties

Posted on by 465

Hi all,

I am trying to create custom view for report purpose in CRM 2016 On premise, I have a date field in that. I want to display only year in that column.

How can I achieve this

Thanks

Naren

  • meelamri Profile Picture
    meelamri 13,204 User Group Leader on at
    RE: Editing view attribute properties

    Hello,

    i recommand Andrew's proposal.

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Editing view attribute properties

    Hi partner,

    You could create a new custom field to show the year of the date field.

    For example, my date field is new_Date and the year field is new_Year, so here is the sample code.

    function getYear(executionContext){
        var formContext=executionContext.getFormContext();
        var dateField=formContext.getAttribute("new_Date").getValue();
        var dateTime=new Date(dateField);
        var year=dateTime.getYear();
        formContext.getAttribute("new_Year").setValue(year);
    }

    And then you just need to add this new year field to your report.

    Best Regards,

    Leo

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: Editing view attribute properties

    Hi Narendra,

    Even you could achieve year column inside SSRS reports as well.

    e.g.

    =Year(Fields!fieldlogicalname.Value)

    or

    DATEPART ( yyyy, date )

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Editing view attribute properties

    Hello,

    I'm afraid you will have to do some additional customizations.

    In order to do that you will have to add whole number field and develop a plugin that will populate that field with year value of your datetime field. After that you can use that field in your view.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans