Any Alternative for getDateFromFormat to use in Service Operation Workspace ?

vijay23
Tera Contributor

Hi , 

i have a requirement to to check if the selected date field in (check_date) is less than Opened date and greater than today ,

 

I need to show an error message..

It's working as expected in the Backend view but in the Service operation workspace, I see an error message shown - " getDateFromFormat is not defined "

Script - 

Onchange of check_date

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var openedDate = new Date(getDateFromFormat(g_form.getValue('opened_at'), g_user_date_time_format));
    var checkDate= new Date(getDateFromFormat(newValue, g_user_date_time_format));
    var today = new Date();
    if (checkDate< openedDate) {
        g_form.clearValue('check_date');
        g_form.showFieldMsg('check_date', getMessage('check_date.info.message'), 'error');
    } else if (checkDate> today) {
        g_form.clearValue('check_date');
        g_form.showFieldMsg('check_date', getMessage('check_date.aftertoday.info.message'), 'error');
    }
}
 
Does anyone encountered this issue in Workspace?
 
Can anyone suggest what would be other alternative to use instead of getDateFromFormat in this script
1 REPLY 1

OlaN
Giga Sage
Giga Sage

Hi,

This sounds like something you could resolve without the use of scripting.

Take a look at this article by Mark Roethof.