How can I make date field to be 3 business days from today's date,selection of any date as less than 3 days, then there should be error message?
This content was last updated in 2019. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 03:55 AM
Do I need to make any script include function?
please reply asap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 07:16 AM
You need to use Ajax call to server as explained by ashutoshm1
but in the script include you need to use glideschedule as I mentioned in above post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 09:39 PM
No need to use glide schedule.
The code above is perfect and runs absolutely fine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 12:07 AM
Hi Namrata,
Good day.. I suggest to use GlideDate and GlideSchedule together.
A before business rule .
var abc= current.field_name;
var date= new GlideDate();
date.setValue(abc);
var xyz= gs.nowDateTime();
var date2= new GlideDate();
date2.setValue(xyz);
var dr=gs.dateDiff(date2,date, false);
var val = parseInt(dr);
if(val>2){
var sch = new GlideSchedule(' Your schedule sys_id ');
if (sch.isInSchedule(date)) {
gs.addInfoMessage("Is in the schedule");
}
else
{
gs.addErrorMessage('Please select a day greater than 3');
current.field_name=date2 //sets todays date
}
}
Please feel free to reach back if you need anything else.
Regards,
Shariq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 12:28 AM
Hi
I am all for simplicity, so maybe this will help you:
How can I make date field to be 3 business days from today's date?
In the default value of the field, add:
javascript:gs.daysAgo(-3);
Sselection of any date as less than 3 days, then there should be error message?
add an onChange client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if(newValue < oldValue) {
alert ('You changed the starting date from ' + oldValue + ' to ' + newValue + " " +'\n' + 'Note that the SLA requires a minimum of 3 days to complete the request.');
}
}
harel