Inbound Email Attachment is not getting queried in After Insert/Update Business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:19 AM
Hi Everyone,
I have created an After Insert/Update Business rule on Incident table. In the script, I have a function querying into sys_attachment table to get the related attachment to the incident.
Issue:
1. While manually creating Incident and attaching an attachment (.png) to it then this function is able to query into the sys_attachment table and get the related record. I have verified by putting logs into the while loop.
2. But when Incident is created through Inbound email action with same attachment(.png) then script is not able to query into the sys_attachment table.
3. Below is the script mentioned:
function addAttachmentsToTransaction(transaction, sourceRecord) {
var attachmentGR = new GlideRecord('sys_attachment');
attachmentGR.addQuery('table_name', sourceRecord.getTableName());
attachmentGR.addQuery('table_sys_id', sourceRecord.getUniqueValue());
attachmentGR.query();
while (attachmentGR.next()) {
var attObj = new GlideSysAttachment();
var att = attObj.getContentStream(attachmentGR.getUniqueValue());
var decodedStream = GlideStringUtil.base64DecodeAsStream(att);
attObj.writeContentStream(transaction, attachmentGR.getValue('file_name'), attachmentGR.getValue('content_type'), decodedStream);
}
}
4. Also another After Insert Business Rule is not getting Triggered despite of satisfying Filter condition in the case of Inbound email action Attachment.
Kindly provide me some insight and solution if you have encounter this type of issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 06:41 AM
business rule conditions are getting satisfied?
Did you add gs.info() in BR as 1st line and see if BR ran?
Did you check if the inbound email action is updating INC with setWorkflow(false)
if yes then none of the BR will trigger?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader