- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2019 05:35 AM
OK try this
function checkDate()
{
var tnow = gs.nowDateTime();
if (gs.dateDiff(current.start_date.getDisplayValue(), tnow , true) <= 0){
gs.addErrorMessage('You cannot implement this change before the approved change windows. ' + current.start_date.getDisplayValue());
current.setAbortAction(true);
}
else
{
moveToImplement()
}
}
function moveToImplement(){
var ga = new GlideAjax("ChangeRequestStateHandlerAjax");
ga.addParam("sysparm_name", "getStateValue");
ga.addParam("sysparm_state_name", "implement");
ga.getXMLAnswer(function(stateValue) {
g_form.setValue("state", stateValue);
gsftSubmit(null, g_form.getFormElement(), "state_model_move_to_implement");
});
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
action.setRedirectURL(current);
}
and note replace Onclick to checkDate()