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 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.