remove attachment on incident inbound action or condition

Les1
Tera Guru

Requirement is for inbound email created incidents of a certain condition (category) to delete any attachment on the incident created. Idea is that for a certain group handling security ops type of tickets, we don't want malicious payloads being attached to the ticket (we dont have the secops module yet).

Guessing this cant be done via the inbound action, so presuming a business rule or other will be needed.

this thread looks promising but i'm not figuring out how to convert it to work for incident tickets.

any advisement appreciated, thanks. 

1 ACCEPTED SOLUTION

Here is the easy method with script. 

1. Go to Business Rules

2. Select table as "Incident"

3. select "Advanced = true"

4. Go to "When to run" tab and add condition as "Category = <Your_category>"

5. When = before

6. Insert = true

7. Add the following script

(function executeRule(current, previous /*null when async*/) {
	
	var attach = new GlideSysAttachment();
	attach.deleteAll(current);
	
})(current, previous);

Let me know how that goes or if you have any questions. Mark this thread as answered if this helps resolve your issue. 

View solution in original post

6 REPLIES 6

Raghu Loganatha
Kilo Guru

Hello, 

I don't think there is any option to avoid adding attachments in inbound action script. How ever, you can try writing an "before insert" business rule on attachment table to ignore the record when your condition matches. 

Let me know if you have questions or mark this thread as "answered/helpful" if this response helps you find solution.

~Raghu.

Thanks Raghu for your response,

I'm not familiar enough with scripting to envision how to tell the platform to 'ignore' the attachment. (i could envision deleting the attachment at insert, but still need help with the actual code involved).

 

Thanks for any further advice.

Les1
Tera Guru

I also wonder if this might be accomplished using Flow Designer? if so then becomes a question of 'better' approach and to me 'better' would be determined by performance and sustainability.

i dont know how flow designer compares to business rules or other flavors of scripting but do know that for sustainability the no-code approach of Flow designer means that someone who isn't a coder can read and understand what the intent is.

 

appreciate feedback or thoughts. thanks

Here is the easy method with script. 

1. Go to Business Rules

2. Select table as "Incident"

3. select "Advanced = true"

4. Go to "When to run" tab and add condition as "Category = <Your_category>"

5. When = before

6. Insert = true

7. Add the following script

(function executeRule(current, previous /*null when async*/) {
	
	var attach = new GlideSysAttachment();
	attach.deleteAll(current);
	
})(current, previous);

Let me know how that goes or if you have any questions. Mark this thread as answered if this helps resolve your issue.