Add error message when adding Parent & child incident

Kusuma Sai
Mega Guru

Hi sir,
1. If i have a added a Parent incident by using reference field - then show the error message on the form
2, If i am adding a child incident by using related list - then show the error message on the form
for 1st scenario - i have written OnChange cs- it works perfectly.

for 2nd scenario - i have written after BR - update - works fine. but when added a parent incident then update/save the incident then it was showing the AfterBR error message. it won't comes when adding a incident in the reference field. please suggest
@Ankur Bawiskar , @Kieran Anson@AndersBGS 

Screenshot 2025-04-16 171652.jpg

1 ACCEPTED SOLUTION

@Kusuma Sai 

it's a expected behavior

the business rule will run when you change the reference field and it's a change to parent field and the BR condition will satisfy and it will throw error

Also when the record is linked with parent via New/Edit the same BR will run as parent field is getting updated.

I believe this much info should help you.

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

24 REPLIES 24

@Kusuma Sai 

so you are getting error message and if you want to stop then use this line after that error message

current.setAbortAction(true);

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

Hi @Ankur Bawiskar Sir,
I have tried that one, but any user opened any incident(ex:INC101) and added incident 'parent Incident' field by using 'reference field' and saved the form, then The Business Rule error message is showing on the form.

please suggest how to abort this

@Kusuma Sai 

so you don't want BR to run when parent field changes

you want BR to only run when Edit is clicked and show the error message then?

I doubt you can separate out the place from where the BR is triggering

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

@Ankur Bawiskar No sir, after adding the child incident the form was reloaded - in that reloaded form - show the error message.
Error message is displayed as expected, but when i am updated an another incident 'parent_incident' field - same error message showing- i don't want that.
only after adding the child incident -then only show the error message.

@Kusuma Sai 

your onchange client script will give error when the value is changed.

try to use this as 1st line in client script just before checking the newValue

g_form.clearMessages();

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