What is best approach in business rule.

niveditakumari
Mega 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
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-...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

View solution in original post

Amit Pandey
Kilo 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
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-...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

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

Amit Pandey
Kilo 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