Incident
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 11:50 PM
I am creating a client script for past value restriction on a field on incident form. but not working please help here what is going wrong
on change client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var expDate =new Date(newValue);
alert(expDate);
var currentDate = new Date();
alert(currentDate);
if (expDate < currentDate) {
//alert('add future date');
g_form.clearValue('u_awaiting_expiration');
g_form.showFieldMsg('u_awaiting_expiration','Select future date','error');
}
}
Issue: alert(expDate);----->this alert is showing wrong in the alert box.. when i select oct 5 2023.. it is showing june 5 2023..
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 11:58 PM
Hi @pavan38
You can try below script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var expDate = getDateFromFormat(newValue, g_user_date_format);
alert(expDate);
var currentDate = new Date();
alert(currentDate);
if (expDate < currentDate) {
//alert('add future date');
g_form.clearValue('u_awaiting_expiration');
g_form.showFieldMsg('u_awaiting_expiration','Select future date','error');
}
}
Please mark my answer helpful and accept as solution if it helped you t👍✔️
Thanks,
Anvesh
Anvesh
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 02:35 AM
@AnveshKumar M Thanks for the input but the alert is showing 0..not working