Cancel Change request

Praveen55
Kilo Explorer

Hello Team,

 

Need your support on the below

 

- Cancel Change Request (State-New) as no implementation is required

- Create New Change Task (State-New\Assess\Implement)

 

Thanks 

11 REPLIES 11

Cancel Change:

I have modified the UI action: Cancel change by adding g_form.checkMandatory = false  but no luck. Attached the modified for your reference. Kindly advise

 

Create New Change Task:

I could use NEW under Change Task tab to create a new task when the change is in New state. However, would require to create new Change task when the Change is approved and in Assess\Implement State. Can you pls provide any screenshot to do that from Workflow

Can you try with below code

 

var changeConfirmCancelDialog;

function loadConfirmDialog() {
        g_form.checkMandatory = false;
	var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
	changeConfirmCancelDialog = new dialogClass("change_confirm_cancel", false, 648, 250);
	changeConfirmCancelDialog.setTitle(new GwtMessage().getMessage("Cancel Change Request"));
	changeConfirmCancelDialog.render();
}

function moveToCancel(notes) {
	var ga = new GlideAjax("ChangeRequestStateHandlerAjax");
	ga.addParam("sysparm_name", "getStateValue");
	ga.addParam("sysparm_state_name", "canceled");
	ga.getXMLAnswer(function(stateValue) {
		g_form.setValue("state", stateValue);
		g_form.setValue("work_notes", notes);
		g_form.checkMandatory = false;
		var changeConfirmCancelDialog;

function loadConfirmDialog() {
	var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
	changeConfirmCancelDialog = new dialogClass("change_confirm_cancel", false, 648, 250);
	changeConfirmCancelDialog.setTitle(new GwtMessage().getMessage("Cancel Change Request"));
	changeConfirmCancelDialog.render();
}

function moveToCancel(notes) {
	var ga = new GlideAjax("ChangeRequestStateHandlerAjax");
	ga.addParam("sysparm_name", "getStateValue");
	ga.addParam("sysparm_state_name", "canceled");
	ga.getXMLAnswer(function(stateValue) {
		g_form.setValue("state", stateValue);
		g_form.setValue("work_notes", notes);
		g_form.checkMandatory = false;
		changeConfirmCancelDialog.destroy();
		gsftSubmit(null, g_form.getFormElement(), "state_model_move_to_canceled");
	});
}

if (typeof window == 'undefined')
   setRedirect();

function setRedirect() {
    current.update();
    action.setRedirectURL(current);
}
		changeConfirmCancelDialog.destroy();
		gsftSubmit(null, g_form.getFormElement(), "state_model_move_to_canceled");
	});
}

if (typeof window == 'undefined')
   setRedirect();

function setRedirect() {
    current.update();
    action.setRedirectURL(current);
}

Please mark this response as correct or helpful if it assisted you with your question.

I have Updated the UI action: Cancel Change with the provided code, however, no luck

 

When I try to use, it asks for Reason and though I enter valid reason, stays at that screen only and at the backend, the mandatory fields are highlighted

See if below thread is helpful

 

https://community.servicenow.com/community?id=community_question&sys_id=a50e4baddb9cdbc01dcaf3231f96...


Please mark this response as correct or helpful if it assisted you with your question.

The provided thread did not work as clicking on the new UI action (cancel_change (client side)) did not perform any action

 

Also, I do not want to modify any of the existing default scripts impacting the organisation. Kindly advise