a way to update the work notes for the related issue record

honamiUeo
Tera Contributor

Is there a way to update the work notes for the related issue record when the change management is closed?

Best regards, and thank you in advance.

 

changerequest1.pngchangerequest2.pngchangerequest3.png

1 ACCEPTED SOLUTION

@honamiUeo 

yes it's possible.

you can use after update BR on Change Request Table

Condition: State Changes to Closed

Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord("problem");
	gr.addQuery("rfc", current.getUniqueValue());
	gr.query();
	while (gr.next()) {
		gr.work_notes = 'The associated change request ' + current.number + ' is closed';
		gr.update();
	}

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

6 REPLIES 6

Sandeep Rajput
Tera Patron
Tera Patron

@honamiUeo You will have to create a onBefore update business rule on the change management record, set the filter to state changes to closed. Make a glide record query to issue record where parent is current change management record and update the worknotes of issue record.

 

I recommend to share the snapshot of related issue record and change management record so that I can share the exact script.

Thanks for the reply.
I have added a caption image.
Do you understand my intention?
Thank you in advance.

Ankur Bawiskar
Tera Patron
Tera Patron

@honamiUeo 

what script did you start with and where are you stuck?

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

Thanks for the reply.
I have added the image and hope you can check it out.
Thank you in advance.