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

Brad Bowman
Kilo Patron
Kilo Patron

Place a 10 second Timer activity in the workflow just prior to the activity that is creating the comment.  Workflows will sometimes run scripts/activities as the last user to interact with the item - so the requestor, approver, or task fulfiller - when the activities are concurrent.  

Anand2799
Tera Guru

Hi @asd22 ,

 

Try this:

current.comments.setJournalEntry("Testing comment", "admin");    //Verify user id of the admin/user you want to use.

 


Thanks

Anand

Ankur Bawiskar
Tera Patron
Tera Patron

@asd22 

approach from @Brad Bowman  will work here.

whenever you add timer of 5-10 seconds in Workflow it runs with system user

Immediately after that set the comments and it will come as System User

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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