Need to populate Field message with Child incident count in Parent incident in field message

praveen47
Tera Contributor

Hi Developers, 

 

I have a requirement like, 

 

I created one new field in INC form called "Resolution" field type is choice. It contains 'New' and 'Existing' choices. This field i am displaying only in parent incidents. When user select 'New' in parent incident, If that parent incident have child incidents still active need to dispaly field message as " You have  active child incidents, please close the child INC before closing parent INC" -- This message i need to show. If all the child incidents are inactive it did not show any message. Can any one help on the script part.

 

Example: If we have 4 child incidents for parent record, Info Message should be "You have 4 active child incidents, please close the child INC's before closing parent INC"

 

Thanks,

Praveen.

10 REPLIES 10

Abhishek Kathe
Mega Guru

You can use onchange client script for the same and following script 

  if(newValue == 'new')	
	   return;
   
	var gr= new GlideRecord('incident');
	gr.addQuery('parent', g_form.getSysId());
	gr.addQuery('active', true);
	gr.query();
	if (gr.next()) {
		alert('Your Message');
	}