web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer Service forum

Setting a value to a custom date field

(0) ShareShare
ReportReport
Posted on by 40

Hi there, I've created a form with a date field (Reporting End Date) which is tied to a custom entity. I want that value to default to the last day of the current month. I can't figure out how to accomplish this using the business rules or by creating a calculated value field. Can someone please help?

Thanks in advance!

I have the same question (0)
  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    use below options, i don't think business rule is able to achieve that.

    Javascript

    - var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);

    [View:https://www.tutorialspoint.com/How-to-get-first-and-last-date-of-the-current-month-with-JavaScript:750:50]

    C#

    stackoverflow.com/.../getting-first-and-last-day-of-the-current-month

  • sunnz Profile Picture
    40 on at

    Thanks for the help!

  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    Please mark my answer as verified if that helped you. Thanks XD

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans