workflow comment as system and not current user

asd22
Tera Contributor

Hello,

I have a workflow for ordered items where I need a comment to be added to the Comments field.
However, when I add this to the workflow activity, the comment is posted as the requesting user instead of as the system.

How can I make the workflow add the comment as the system user instead of the user who placed the order?

1 ACCEPTED SOLUTION

@asd22 This code works in server side script so should work in workflows as well.

Try the suggestion by @Brad Bowman  . If this does not work check the user value . Also confirm that the workflow runs on the same table which record you are updating because if it is not the case the current will not work.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

View solution in original post

7 REPLIES 7

RaghavSh
Mega Patron

This need to be done by : 

 

current.comments.setJournalEntry('Test comment', 'system'); //set the userid of user incase it is not system in your instance.

 

Refer : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0748347 


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

asd22
Tera Contributor

i tried this, but the comment still got posted as the current user: 

asd22_0-1763995204712.png

 

@asd22 This code works in server side script so should work in workflows as well.

Try the suggestion by @Brad Bowman  . If this does not work check the user value . Also confirm that the workflow runs on the same table which record you are updating because if it is not the case the current will not work.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023
LinkedIn

@asd22 Did this answer your query?


Raghav
MVP 2023
LinkedIn