Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Creating a sortable field for days since modified?

Posted on by 10

We have a need for a field to show the number of days since an opportunity was modified. however we would like to sort a view based on this table. this seems easy enough, I created a calculated field to calculate the difference between DateModified and NOW(). This works great except you can not use it to sort a view. My best guess is Dynamics treats either DateModified or NOW as a calculated field and will not allow sorting by a calculated field if it relies on another entity or another calculated field (this is listed in the documentation.

so the question is, is there any work around?

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Creating a sortable field for days since modified?

    Hello,

    I believe you will need to develop the plugin that will do that "calculation" job for you. The key point - it has to be "pre-update" plugin and set the field using the context.

  • jdetmold Profile Picture
    jdetmold 10 on at
    RE: Creating a sortable field for days since modified?

    unfortunately changing a field from a workflow changes the date modified value and makes the data no good

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creating a sortable field for days since modified?

    Hi jdetmold,

    Yes, I tested it and it couldn't be sorted in the view. There's a limitation that can’t use values in calculated columns on a logical value in the same table to sort data returned by a query as the doc says:

    Calculated and rollup columns (Microsoft Dataverse) - Power Apps | Microsoft Docs

    You could create another non-calculated whole number field and use a business rule/workflow to populate the value to be the same as the calculated field.

    Please refer to this link:

    Sorting a calculated field in a view in unified interface | Customer Engagement & Dynamics CRM Forum (crmug.com)

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

Product updates

Dynamics 365 release plans