- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
4 hours ago
Out of the box, a Service Exchange Remote Task Definition with Send Attachments = true will sync all attachments to the partner instance, and with Send Attachments = false will not sync any attachments.
This solution adds a middle ground:
- when Send Attachments = false, only the attachments that match a customer-defined condition are synced.
- when Send Attachments = true, out-of-box behavior is unchanged and all attachments are synced.
An asynchronous business rule, SE Con Cond Sync Att from Parent Task, is created on sys_attachment table. No edits are made to any out-of-box business rules. On attachment insert the business rule resolves the parent record to its matching Service Exchange remote task(s), reads the definition's send_attachments flag, and if send_attachments flag is false AND the attachment matches the configured condition, syncs the attachment to the provider instance.
Business Rule Condition
The business rule condition uses the same guards as the out-of-box sync attachments business rule but works inside the Global scope.
The Condition
!new sn_sb.SBTransportUtilBase().isTransporterUser(gs.getUserName()) &&
current.getValue("table_name").slice(0,6) != "sn_sb_" &&
new GlideRecord(current.getValue("table_name")).instanceOf("task")
Why each part of the condition?
- isTransporterUser(...) - skip attachments created by the transporter service account (prevents re-processing replicated copies).
- table_name.slice(0,6) != "sn_sb_" - skip the attachment copies that land on remote task records.
- GlideRecord(...).instanceOf("task") replaces GlideTableHierarchy because GlideTableHierarchy is not defined in a Global business rule. – only sync for extension of task table.
Included in Update Set
- Global async business rule: SE Con Cond Sync Att from Parent Task
- System property: sn_sb_attach_filter.consumer.query
This code is not an official ServiceNow product and is provided as-is without warranty or support. Test thoroughly in a non-production environment before use on any production instance.