- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2016 06:10 AM
I'm trying to send an email notification to assignment group in incident task record when new/update attachment is added.
Any idea?
"Include Attachments" option sends only on the update in the incident record.
Any help on how to trigger an email notification when attachment alone added?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2016 08:05 PM
Hello Teju,
I have used a similar method for onboarding new users. Here is what I had to do.
I wanted new users on the project to upload required security documents. Once they uploaded documents, based on the conditions that their attachments that were uploaded to their profile contained the key words "HIPAA" and "DHS" would trigger an event (notice the event name that is created is "onboard.attachment").
off the event, an email notification and template would be shot out.
BR - User Form Attach Notify
var userrec = new GlideRecord("sys_user");
userrec.get(current.table_sys_id);
var today = new GlideDate;
var pattern = "HIPAA";
var result = current.file_name.match(pattern);
if (JSUtil.has(result) ) {
gs.log("filename " + current.file_name + " for user " + userrec.name + " contains " + pattern);
gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
}
else {
pattern = "DHS";
result = current.file_name.match(pattern);
if (JSUtil.has(result) ) {
gs.log("filename " + current.file_name + " for user " + userrec.name + " contains " + pattern);
gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
}
else gs.log("filename " + current.file_name + " for user " + userrec.name + " not matched to a pattern");
}
//gs.log("user " + userrec.name);
//if (userrec.sys_created_on > gs.daysAgo(30)) {
// gs.log(" new user " + userrec.name + ", created " + userrec.sys_created_on + " just attached file " + current.file_name );
//Queue the email send event
//Pass in event name, record(not applicable here), custom parm1, and custom parm2
//Custom parm1 is the count of incidents queried and can be referenced from the email notification that responds to the queued event by using '${event.parm1}' in the email notification record.
//gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
//gs.getUserName()
//}
//else gs.log(" old user attachment, created " + userrec.sys_created_on + " just attached file " + current.file_name );
The Email Notification that fires off the event named "onboard.attachment" and the email template associated with the email notification.
Now based on your request you were wanting to apply a similar situation to an incident. simply change the code that references the "sys_user" table in the GlideRecord to the incident table and the file names that are being searched for. You could also look at this old code we have when we were not searching attachments based on file names.
var userrec = new GlideRecord("sys_user");
- userrec.get(current.table_sys_id);
var today = new GlideDate;
- gs.log("user " + userrec.name);
if (userrec.sys_created_on > gs.daysAgo(14)) {
gs.log(" new user " + userrec.name + ", created " + userrec.sys_created_on + " just attached file " + current.file_name );
//Queue the email send event
//Pass in event name, record(not applicable here), custom parm1, and custom parm2
//Custom parm1 is the count of incidents queried and can be referenced from the email notification that responds to the queued event by using '${event.parm1}' in the email notification record.
- gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
//gs.getUserName()
}
else gs.log(" old user attachment, created " + userrec.sys_created_on + " just attached file " + current.file_name );
I hope this helps. Please let me know should you have any questions.
Sincerely,
Orlando Galindo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 02:59 AM
One issue on this,
Whenever update is done it brings always attachments in the email notification. I checked "Include Attachment" in the update notification because we need this whenever attachment is added. Only update notification should be sent out without attachments (whenever attachment is not added)
any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2016 07:18 PM
Hi mach,
So or all the simple updates ( like adding addtional comments into the record) takes attachments also into the update notification. How can we supress the attachment when there is a simple update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2016 02:10 AM
I don't see directly a solution to this one, we don't include attachments.
I think you should create that hi ticket and follow up there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2016 08:05 PM
Hello Teju,
I have used a similar method for onboarding new users. Here is what I had to do.
I wanted new users on the project to upload required security documents. Once they uploaded documents, based on the conditions that their attachments that were uploaded to their profile contained the key words "HIPAA" and "DHS" would trigger an event (notice the event name that is created is "onboard.attachment").
off the event, an email notification and template would be shot out.
BR - User Form Attach Notify
var userrec = new GlideRecord("sys_user");
userrec.get(current.table_sys_id);
var today = new GlideDate;
var pattern = "HIPAA";
var result = current.file_name.match(pattern);
if (JSUtil.has(result) ) {
gs.log("filename " + current.file_name + " for user " + userrec.name + " contains " + pattern);
gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
}
else {
pattern = "DHS";
result = current.file_name.match(pattern);
if (JSUtil.has(result) ) {
gs.log("filename " + current.file_name + " for user " + userrec.name + " contains " + pattern);
gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
}
else gs.log("filename " + current.file_name + " for user " + userrec.name + " not matched to a pattern");
}
//gs.log("user " + userrec.name);
//if (userrec.sys_created_on > gs.daysAgo(30)) {
// gs.log(" new user " + userrec.name + ", created " + userrec.sys_created_on + " just attached file " + current.file_name );
//Queue the email send event
//Pass in event name, record(not applicable here), custom parm1, and custom parm2
//Custom parm1 is the count of incidents queried and can be referenced from the email notification that responds to the queued event by using '${event.parm1}' in the email notification record.
//gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
//gs.getUserName()
//}
//else gs.log(" old user attachment, created " + userrec.sys_created_on + " just attached file " + current.file_name );
The Email Notification that fires off the event named "onboard.attachment" and the email template associated with the email notification.
Now based on your request you were wanting to apply a similar situation to an incident. simply change the code that references the "sys_user" table in the GlideRecord to the incident table and the file names that are being searched for. You could also look at this old code we have when we were not searching attachments based on file names.
var userrec = new GlideRecord("sys_user");
- userrec.get(current.table_sys_id);
var today = new GlideDate;
- gs.log("user " + userrec.name);
if (userrec.sys_created_on > gs.daysAgo(14)) {
gs.log(" new user " + userrec.name + ", created " + userrec.sys_created_on + " just attached file " + current.file_name );
//Queue the email send event
//Pass in event name, record(not applicable here), custom parm1, and custom parm2
//Custom parm1 is the count of incidents queried and can be referenced from the email notification that responds to the queued event by using '${event.parm1}' in the email notification record.
- gs.eventQueue('onboard.attachment', current, gs.getUserDisplayName(), userrec.name);
//gs.getUserName()
}
else gs.log(" old user attachment, created " + userrec.sys_created_on + " just attached file " + current.file_name );
I hope this helps. Please let me know should you have any questions.
Sincerely,
Orlando Galindo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2016 11:22 PM
Brilliant Thanks Orlando