How to find business days between 2 dates from form through client script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2022 04:37 AM
How to find business days between 2 dates from form through client script ?
It must exclude the weekends. Note - This needs to be achieved from client script when start date and end dates are filled and immediately the duration field below it must populate the days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 11:01 PM
Hi @Snehal13
As mentioned in before response, you can exclude weekends and holidays in the Schedule record you will create and than it will run only for working days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2023 08:13 PM
Hi Anubhav,
I am using same your code. but it is not giving right answer.
out put
00:00:00
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 08:24 AM
hi,
Try it.
function DateDiff() {
var datefrom = Xrm.Page.getAttribute("new_datefrom").getValue();
var dateto = Xrm.Page.getAttribute("new_dateto").getValue();
var days = (dateto - datefrom) / (1000 * 60 * 60 * 24);
Xrm.Page.getAttribute("new_daydiff").setValue(days);
}Thanks.