- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-21-2024 01:41 PM
In our IT Dept, we have a group of ITSM users who work with sensitive information, and despite repeated requests from our IT Security leadership, they regularly attach files containing sensitive information.
We are a 24/7 shop, and the night-shift techs have bandwidth to review attachments and report on findings. IT Security has requested a basic setup where we can capture every instance of the attachment.uploaded event in the incidents table, by creating a record in a custom table. The night shift could then review the incidents that had attachments uploaded that day and identify those that have sensitive information.
My assignment is to create an automated step so that, when an event with the name attachment.uploaded and state is processed is created, if Parm1 is incident, then a record is created in a custom table with Parm1, Parm 2 and Created fields written there.
I'm familiar with flow designer, and with the old-school business rules, but script actions are on the bleeding edge of my capabilities. Here's what I came up with, and it does not work, even with static values, let alone grabbing the parameters from the event record. Any help would be greatly appreciated!
Script Action:
//Create a new record in a custom table
var gr = new GlideRecord('u_attachment_audits');
gr.initialize();
gr.u_table = 'parm1';
gr.u_record = 'parm2';
gr.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-22-2024 12:07 AM
Hi @Debby Shea Ande,
please check below script:
//Create a new record in a custom table
var gr = new GlideRecord('u_attachment_audits');
gr.initialize();
// Get the event parameters
var parm1 = event.parm1;
var parm2 = event.parm2;
// Set the values in the custom table
gr.u_table = parm1;
gr.u_record = parm2;
gr.u_created = new GlideDateTime(); // Assuming you want to store the current date and time
// Insert the record
gr.insert();
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-22-2024 12:07 AM
Hi @Debby Shea Ande,
please check below script:
//Create a new record in a custom table
var gr = new GlideRecord('u_attachment_audits');
gr.initialize();
// Get the event parameters
var parm1 = event.parm1;
var parm2 = event.parm2;
// Set the values in the custom table
gr.u_table = parm1;
gr.u_record = parm2;
gr.u_created = new GlideDateTime(); // Assuming you want to store the current date and time
// Insert the record
gr.insert();
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-24-2024 09:31 AM
This was very helpful; unfortunately, it didn't work. I receive a message that a declaration in the script is deprecated. The script does not result in a new entry in the custom table. I don't know whether these are related.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-24-2024 10:01 AM
My apologies! It worked great! I had a typographical error in the name of the custom table. Thank you very much for sharing your expertise.