Issue with attachment comments updated by system not by the logged in user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 01:14 AM
On change form when we used to attached the file in actives comments are updated by system it is not showing the logged in user. Those comments are coming from script actions. is there any way to update the name by logged in user instead of system ? All inputs are much appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 01:35 AM
@Kranthi Rohit If you are using the script action to update the comments then they will always be from system as the script actions are executed by system only. Instead of adding the comment using a script action, you can try adding it via an async business rule and the comment would be marked from the user's account.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 02:33 AM
Hi @Kranthi Rohit ,
If you still want to try in script action , You can try this:
1)Pass logged in user sys_id from your gs.eventQueue and impersonate it in the script action
2)Script Action:
Output:
Hope this helps!!!
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 03:06 AM
Hello Hemanth,
Your suggestion is much helpful we use the second one that displays as the guest instead of system, so please guide me . Where should we add the first script?
gs.event Queue("ptin",current,current.sys_id,gs.getUserID();
could you please navigate me in the instance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 03:12 AM
Hi @Kranthi Rohit ,
Do you know how the script action being called when attachment is added?? must be a Business Rule or flowdesigner, find that.
There you can find gs.eventQueue, add gs.getUserID() paramter and go to script action >>the add impersonation logic.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025