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.

How to update additional comments as comments in case form

Gopal14
Tera Contributor

Hi,

 

create a new case from the Customer Service > case > Create New. 

 

After creating  new case, we can create a incident from a case.

 

Gopal14_0-1717040821117.png

 

After Incident is created, when we update any comments in incident form, in case Activity stream it will update as a Work Note.

 

However, We need to update that comment in case as a Additional Comments.

 

we have tried to updating OOTB script, however script include is on protection policy.

 

How to achieve this?

3 REPLIES 3

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello,

To update additional comments as comments in a case form from an incident form in ServiceNow, you'll need to create a custom business rule or script to handle this functionality. Since the Out-of-the-Box (OOTB) script include is protected and cannot be modified, creating a custom solution is the way to go. Here’s how you can achieve this:

Steps to Update Comments from Incident to Case

  1. Create a Business Rule on the Incident Table:

    • Go to System Definition > Business Rules.
    • Click New to create a new business rule.
  2. Configure the Business Rule:

    • Name: Provide a name, e.g., Update Case Comments from Incident.
    • Table: Select Incident [incident].
    • When: Choose after.
    • Insert: Ensure this is checked (as we want this to trigger after an incident is updated).
    • Update: Ensure this is checked (as we want this to trigger after an incident is updated).
  3. Condition:

    • You can set a condition to check if comments were updated, e.g., current.comments.changes().
  4. Script:

    • In the Advanced tab, write a script to update the additional comments in the related case.

Here’s an example script that can be used in the business rule:

 

(function executeRule(current, previous /*null when async*/) { // Check if the incident has a related case if (current.u_case) { // Get the related case record var caseGR = new GlideRecord('sn_customerservice_case'); if (caseGR.get(current.u_case)) { // Append the incident comments to the case's additional comments caseGR.comments = current.comments.getJournalEntry(1); // Get the latest comment caseGR.update(); } } })(current, previous);

 

 Regards,

Vaishnavi Lathkar

Hi @Vaishnavi Lathk 

 

I have updated the code,

 

Gopal14_0-1717049786286.png

 

Gopal14_1-1717049819374.png

 

 

In case still it is updating as a worknotes, not as a comments

Ankur Bawiskar
Tera Patron
Tera Patron

@Gopal14 

comments are for end users and work notes are for agents

did you try to have your custom logic?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader