Need to Copy the Work Notes to Additional Comments

Shrey hurana
Tera Contributor

I Need to Copy the Work Notes to Additional Comments on the incident form when the work notes of the incident is being updated after 5 days of the last update.

I tried using the After Business rule in order to copy the Work notes to Additional Comments and it is working fine. But it should only be copied it the Current date is greater or equal to 5 days from the last update.

Can someone please help me with the same.

2 REPLIES 2

Amit Pandey
Kilo Sage

Hi @Shrey hurana 

 

You can write the following condition in the script section of your business rule-

 

    var currentDate = new GlideDateTime();
    var lastUpdatedDate = new GlideDateTime(current.sys_updated_on);

    var diffInDays = GlideDateTime.subtract(currentDate, lastUpdatedDate).getNumericValue() / (1000 * 60 * 60 * 24);

    if (diffInDays >= 5) {
        Your Business Rule 
    }

 

Please mark my answer helpful and correct.

 

Regards,

Amit

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Shrey hurana 

 

Don't do this. Work notes are for the internal team and additional comments are for the customer. Why do you want to share the internal comments with the customer /caller?

*************************************************************************************************************
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]

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