How to Trigger Business Rule from Related Record Changes?

thullurishalini
Kilo Guru

Hi everyone,

I need to trigger a business rule in a parent record (e.g., Incident) when a field in a related child record (e.g., Work Note) is updated.

4 ACCEPTED SOLUTIONS

Aditya02
Tera Guru

Hi @thullurishalini ,

 

I accomplished this by creating a business rule on the Work Note (Journal) table (sys_journal_field) that updates a field in the parent Incident when a work note is modified. This in turn triggers a business rule on the parent Incident.

 

You can follow the below steps and Code for business rule to achieve this:

  • Create a Business Rule on the Work Note (Journal) table (sys_journal_field).
  • In the Business Rule:
          a. When: After
          b. Condition: You can specify your own condition, such as when a specific field is updated.
          c. Script:

(function executeRule(current, previous /*null when async*/) {
       if (current.element_id == 'incident') {                                 // Check if the work note is related to an incident
             var incidentGR = new GlideRecord('incident');           // Get the parent incident record
             if (incidentGR.get(current.element)) {
                         // Write the script what you want to perform
              }
       }
})(current, previous);

 

 

 

===================================***************=========================================

"If you found my answer helpful, please give it a like and mark it as the accepted solution. It helps others find the solution more easily and supports the community!"

 

Thanks & Regards,

Aditya

=====================================***********==========================================

 

 

View solution in original post

brahmandlapally
Mega Guru

Hi @thullurishalini.

Create a After BR on table (sys_journal_field) so whenever the worknote updated the BR triggers

Thank you

View solution in original post

Anantha27
Mega Guru

Hi @thullurishalini 

You can use the script in the BR at the advance tab as follows

if (current.your_field_name.changes()) {
   var parentRecord = new GlideRecord('incident');
   if (parentRecord.get(current.parent)) {         

parentRecord.state = '3'; 
       parentRecord.update();
   }
}

This may help you to trigger the BR

Thank you

View solution in original post

Sai Krishna6147
Mega Guru

Hi @thullurishalini 

Please refer to this link. It may helps to you
Refer: https://www.servicenow.com/community/developer-forum/need-business-rule-to-update-parent-state/m-p/1... 

Please mark this response as correct or helpful if it assisted you with your question.

Thank you

View solution in original post

10 REPLIES 10

Sandeep Rajput
Tera Patron
Tera Patron

@thullurishalini You’ll need to create a business rule on the child record table that runs when the specific field is updated. This rule will trigger a script that updates the parent record, causing any business rules on the parent to run.

VishaalRanS
Tera Guru

Hi @thullurishalini 

 

To trigger a business rule in a parent record (like an Incident) when a field in a related child record (such as a Work Note) is updated in ServiceNow, you can create an After Business Rule on the Child Table and define Conditions:( For instance, you might want it to trigger only when certain fields are updated or when specific conditions are met.)

 

Please go through the below link:

Solved: Need Business Rule to Update Parent State - ServiceNow Community

 

Thanks, and Regards

Vishaal

Please mark this response as correct or helpful if it assisted you with your question.

Ravi Gaurav
Giga Sage
Giga Sage

Hi @thullurishalini 
The Below link will help you to build the logic.


https://www.youtube.com/watch?v=A8HHcfix8tI

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

OlaN
Giga Sage
Giga Sage

Hi,

In the scenario described, it's almost always better to create a Flow instead of writing a custom business rule,

this will most likely skip the need for scripting.