How to Restrict a Child incident not to be a parent incident to other

harinya
Tera Contributor

Hi 
Below is My Requirement,
Can some one please hep
When user tries to add parent for an incident, it needs to check parent incident entered by user is child incident(it should be a child to any incident) or not
If it's child Incident Then it should update the parent incident and provide a message "child incident can't be parent incident" and it abort the action
If it's not child incident to any incident then parent incident column should get updated with given incident and also update the assignment group same as parent incident that user entered


Thanks 

1 ACCEPTED SOLUTION

James-B
Kilo Sage

You could just amend the reference qualifier on the parent incident field to:

 

 

Snag_9971037.png

 

This would prevent users from being able to select any incident that already has a parent incident. This would also work at from a list. 

 

What you have asked for is possible but to make it work when the user selects the incident you would have to use a client script and a client callable script include. You could use a business rule to do the same thing but that wouldn't work until the user has submitted and could potentially waste the users time. 

View solution in original post

6 REPLIES 6

James-B
Kilo Sage

You could just amend the reference qualifier on the parent incident field to:

 

 

Snag_9971037.png

 

This would prevent users from being able to select any incident that already has a parent incident. This would also work at from a list. 

 

What you have asked for is possible but to make it work when the user selects the incident you would have to use a client script and a client callable script include. You could use a business rule to do the same thing but that wouldn't work until the user has submitted and could potentially waste the users time. 

Cris P
Tera Guru

You can do this with a UI Policy as below:

 

CrisP_0-1713280486229.png

Then use the below script to check the Incident they are inputting:

CrisP_1-1713280620064.png

 

function onCondition() {

	g_form.getReference('parent_incident', function(gr){ 
		if(gr.parent_incident != ''){
			
			g_form.addErrorMessage('The incident is already a child of another incident ');
			g_form.clearValue('parent_incident');
		}

		
	});

}

 

 

It would probably be more efficient to just modify the parent_incident field dictionary entry 

Reference qual, by adding 'parent_incident=NULL'
 

Good shout, didnt think about a UI Policy. 

harinya
Tera Contributor

Thanks for Response
but it's not working