Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Question About field Additional Comments

ItayB
Tera Contributor

Hello Guys, 

This is my mission: 

 

"When the customer (requested for) - writes a comment (Additional comment) on the request: the comment will be copied to all open tasks."

 

I tried to use Business Rule but there is what happened:

* The Comment will not seen in the tasks of the RITM. 

* The Comment write twice in the SOW view and in the RITM View.

 

ItayB_0-1751466544307.png

ItayB_1-1751466577648.png

 

 

6 REPLIES 6

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @ItayB 

What’s the business case for showing comments on all item tasks? The comment might not be relevant to every task. Also, when the end user adds a comment, it goes to the RITM—not the tasks—since users only have the option to comment on the RITM from the portal, not individual tasks."

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

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

Masthan Sharif
Tera Guru

Hi @ItayB,

Hope you're doing well!
Can you try using the below line at line 13 in your script?

  taskGr.comments.setJournalEntry(comment); 

 

Best Regards,

Sharif

Chaitanya ILCR
Mega Patron

Hi @ItayB 

 

update your script as 

(function executeRule(current, previous /*null when async*/ ) {

    var taskGr = new GlideRecord('sc_task');
    taskGr.addEncodedQuery('request_item=' + current.getValue('sys_id') + '^stateIN1,2');
    taskGr.query();

    while (taskGr.next()) {
        taskGr.comments = current.comments;
        taskGr.update();
    }

})(current, previous);

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Thanks everyone for the comments!


This script fixed this problem:
* The Comment will not seen in the tasks of the RITM. 

but this problem still happening:

* The Comment write twice in the SOW view and in the RITM View.