The CreatorCon Call for Content is officially open! Get started here.

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
Giga 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

Ravi Gaurav
Giga Sage
Giga Sage

Hi @thullurishalini 

Create a Business Rule on the Work Note (Journal) table (sys_journal_field). Follow these steps:

  1. When: Set the condition to "After" the record is saved.
  2. Condition: Define your specific condition, such as triggering when a particular field is updated.
  3. Script:
    (function executeRule(current, previous /*null when async*/) {
    // Check if the work note is associated with an incident
    if (current.element_id == 'incident') {
    var incidentGR = new GlideRecord('incident'); // Query the parent incident record
    if (incidentGR.get(current.element)) {
    // Add the logic you want to execute here
    }
    }
    })(current, previous);

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


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/