How to post comments as system instead of current user in scoped application

Swathi P
Kilo Sage

Hello Team,

 

I am trying to post comments via script in scoped application but in the activity stream it is showing as Logged in User i wanted to show it as system i cant use setJournalEntry() method in scoped application script How to achieve this

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Swathi P 

you can create a workflow on that table in your scoped app and give Wait for Duration with 2-3 seconds

Once that Wait for Duration is done you can use script to set 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

Hi Ankur, I have added the wait duration in Flow and the flow is running as System

@Swathi P 

you can try to use custom flow action and use script step to create record into sys_journal_field and set the sys_created_by = System

OR

please use workflow and use approach I mentioned of timer

💡 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

John Gilmore
Giga Guru

This is going to depend on the nature of the script you are running.

If you are running a client side script then I don't believe there is a way to perform the action as the System user. I think you would have to create an event caller to queue an event to trigger a server side script/flow that you could set to run as/by the system user.

If you are in a workflow action or server side script (not a script include) then you should have the option to set it to run as system.