- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:54 AM
hi Hemanth,
I am new to this script action , I don't how the script actions are called in BR /Flow designer I checked every where I couldn't find .If you know how it called and where it is?. Please navigate me to there. That would be really a great help for me. thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:14 AM
Try bellow script in your action :
// Get the current logged-in user
var currentUser = gs.getUserID();
// GlideRecord to update the active comments field (assuming the table is 'incident')
var gr = new GlideRecord('incident');
if (gr.get(current.sys_id)) {
// Update the comments with the logged-in user's ID
gr.comments = "File attached by " + gs.getUserName(); // Add your custom message here
gr.setValue('sys_updated_by', gs.getUserName()); // Update sys_updated_by to the logged-in user
gr.update(); // Update the record
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 03:32 AM
Hi Rajesh,
Thanks for your response,
It's taking the current user as system by default. its not showing the logged in user name.