- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 05:12 AM
Hello Im looking for a business rule I can run to check and see if an attachment is added to the INC ticket, and if one is update the state to work in progress.
Solved! Go to Solution.
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 05:45 AM
Since you need the BR to trigger when an attachment is added to the incident (which does not, by itself, trigger as an update to the Incident) you would want to run your BR off of the sys_attachment table.
Table: Attachment [sys_attachment]
Advanced: checked
When to Run: After, Insert.
Condition: Table name is incident
Script: (update state value as needed)
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.get(current.table_sys_id);
inc.state=2;
inc.update();
})(current, previous);
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 05:24 AM
Hi,
you can use this in the BR
if(current.hasAttachments()){
// update state to in progress
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 05:45 AM
Since you need the BR to trigger when an attachment is added to the incident (which does not, by itself, trigger as an update to the Incident) you would want to run your BR off of the sys_attachment table.
Table: Attachment [sys_attachment]
Advanced: checked
When to Run: After, Insert.
Condition: Table name is incident
Script: (update state value as needed)
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.get(current.table_sys_id);
inc.state=2;
inc.update();
})(current, previous);
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2021 05:32 AM
Thank you so much this was just the start I needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 06:01 AM
Hi ,
You can use use hasAttachment() method to check whether current record carrying any attachment or not in your IF condition .
or you can use glide in your BR
var attachments = new GlideRecord('sys_attachment');
attachments.addQuery('table_sys_id',current.sys_id);
attachments.query();
var rowCount = attachments.getRowCount();
and use rowCount in your If condition . if its more then 0 then it will help you to apply conditions according to your requirement.
Thanks ,