We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

What is best approach in business rule.

niveditakumari
Giga Sage

Hi, 

 

What is best approach in business rule. I have one requirement to update comments from HR task table to HR case table and I know how to achieve we can use before and after business rule to achieve that.

Can anyone please tell which best approach should I use before business rule or after business rule. 

 

Regards, 

Nivedita 

 

 

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron

Hi @niveditakumari 

 

Create After BR rule and copy the notes. 

 

https://www.servicenow.com/community/itsm-forum/how-to-copy-whole-work-note-from-task-to-incident/m-...

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Amit Pandey
Mega Sage

Hi @niveditakumari 

 

Would recommend you to use After insert/update business rule on HR Task table with following Business Rule script-

 

(function executeRule(current, previous /*null when async*/) {
    var caseGr = new GlideRecord('HR_Case'); //enter the correct table name
    if (caseGr.get(current.hr_case)) {
        caseGr.comments = current.comments;
        caseGr.update();
    }
})(current, previous);

 Please mark my answer helpful and correct.

 

Regards,

Amit

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron

Hi @niveditakumari 

 

Create After BR rule and copy the notes. 

 

https://www.servicenow.com/community/itsm-forum/how-to-copy-whole-work-note-from-task-to-incident/m-...

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Amit Pandey
Mega Sage

Hi @niveditakumari 

 

Would recommend you to use After insert/update business rule on HR Task table with following Business Rule script-

 

(function executeRule(current, previous /*null when async*/) {
    var caseGr = new GlideRecord('HR_Case'); //enter the correct table name
    if (caseGr.get(current.hr_case)) {
        caseGr.comments = current.comments;
        caseGr.update();
    }
})(current, previous);

 Please mark my answer helpful and correct.

 

Regards,

Amit