closing of problem record only when all the problem tasks are closed

msc
Tera Contributor

Hi everyone,

In problem record , problem record will  be closed only  when all the ptasks are closed complete. before the record is closed  then a message should be display please close the ptask .

if we cancel the problem record then all the problem task will  be changed to closed complete auttomatically.

9 REPLIES 9

HI ankur ,

there is no existing ui action here ,only thing is when problem record get cancel then their  ptasks get marked as closed automatically

 

 

Hi,

then create new UI action Cancel on problem table

Make that UI Action as server side and add the script I shared.

Follow the steps and share us the update

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@msc 

Any update on this?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes its worked but they dont want the ui action they are asking script like if the  state value  is cancel  then problem task can also be automatically closecomplete.

@msc 

Glad to know that my script worked.

then you would require after update BR on problem table

Condition: State [Changes to] Cancel

Script:

try{
		// your code
		var gr = new GlideRecord("problem_task");
		gr.addQuery("problem", current.getUniqueValue());
		gr.query();
		while(gr.next()) {
			gr.state = 157; // closed
			gr.update();
		}
	}
	catch(ex){
		gs.info(ex);
	}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader