Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Pop up confirmation on state change, not using a UI Action

heathers_
Kilo Sage

We have a requirement to add a pop-up confirmation message when saving a change task to complete. We are not using an UI Action button for the close task but instead saving from the state field choice list. I was able to accomplish the alert pop-up through a client script but I need them to be able to select 'Yes' or 'No'. If no is selected, then the change task will not save. Thanks in advance for your assistance.

1 ACCEPTED SOLUTION

heathers_
Kilo Sage

Thank you all. I was also able to accomplish my desired results with this onSubmit client script.

 

function onSubmit() {
	
	var state = g_form.getValue('state');
	
	if((state == 3) || (state == 4) || (state == 7)){
		return confirm('Are you sure you want to close this task?');
	}
	
	if(state == 6){
		return confirm('Are you sure you want to cancel this task?');
	}
	
}

View solution in original post

5 REPLIES 5

Heathers, I am using your script to solve an issue however I would like this to apply to only a particular assignment group (ITPMO).

On your script how can I also check if current assignment group = ITPMO