If changes in parent incident I need to change in child incident as parent incident

Siva82
Tera Expert

Hi all.

If i am changing the parent state and on hold fields then i need change the child state and on hold fields.

for this I using after business. But getting results.

Can you help me on that.

Can please refer attachment for my business rule .

find_real_file.png

find_real_file.png

Thank you

1 ACCEPTED SOLUTION

Sulabh Garg
Mega Sage
Mega Sage

Hello

Please change the script like this..

var incident = new GlideRecord('incident');
incident.addQuery('parent', current.sys_id);
incident.query();
while(incident.next()){

incident.state = current.state;

incident.update();

}

 

Please Mark Correct/helpful, if applicable, Thanks!! 

Regards

Sulabh Garg

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

View solution in original post

13 REPLIES 13

shloke04
Kilo Patron

Hi,

Please use the BR as per details below:

Table : Incident

After Update

Condition : State Changes:

Script:

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

	// Add your code here
	var gr = new GlideRecord('incident');
	gr.addQuery('parent_incident',current.sys_id);
	gr.query();
	while(gr.next()){
		gr.state = current.state;
		gr.update();
	}

})(current, previous);

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Sulabh Garg
Mega Sage
Mega Sage

Hello

Please change the script like this..

var incident = new GlideRecord('incident');
incident.addQuery('parent', current.sys_id);
incident.query();
while(incident.next()){

incident.state = current.state;

incident.update();

}

 

Please Mark Correct/helpful, if applicable, Thanks!! 

Regards

Sulabh Garg

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Hi Shloke,

Thank you for quick response,

I am using this condition and code but i am not getting results.

Thank you

Hi sulabh,

Thank you for quick response,

I am using this condition and code but i am not getting results.

Thank you