Add an automated worknote

Originally asked by Jorden Van Bogaert on 25 February 2022 (original question)


Hi

We’re looking for a way to add a work note in ServiceNow, even if the replica has no comment. For example, to close a “catalogTask”, a work note is required.

We check in the incoming sync if the remote side was “resolved” and based on that we wanted to simply insert a work note. On the documentation is says the work_note enitity is not supported and the commentHelper class seems to not support addComment in ServiceNow.

Any ideas on how to achieve it?

Thanks in advance!

Kind regards

Jorden


Answer by Francis Martens (Exalate) on 25 February 2022

You can assign the value to entity.work_notes like in

incident.work_notes = "Hello World"

This should be sufficient.

Very important - don’t do

incident.work_notes = incident.work_notes + "Hello World"

( or its alternative using the += operator)

Because that is doubling the content and can kill access to the incident …


Comments:

Jorden Van Bogaert commented on 25 February 2022

Hi Francis

Thanks a lot! It is that simple (old community)

The warning on the “+” operator in the documentation scared me into trying anything with the work_notes entity at all. (old community)

Thanks again!

Francis Martens (Exalate) commented on 25 February 2022

The warning is because things can really go wrong.

Let me know how it goes

Jorden Van Bogaert commented on 25 March 2022

Worked like a charm, thanks a lot!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.