Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

RITM Attachment Sync After Submission

supriya pratapa
Tera Guru

We have a flow that is triggered when an RITM (Request Item) is created. This flow copies any attachments from the RITM to SharePoint upon submission. However, users may add attachments to the RITM even after it has been submitted. How can we modify the flow to also copy these attachments that are added post-submission

7 REPLIES 7

Service_RNow
Mega Sage

Hi @supriya pratapa 

 

Use "Attachment [sys_attachment]" Table Trigger

You can create a new Flow that triggers whenever an attachment is added to an RITM after it's been submitted.

1. Create a New Flow (or Subflow)

  • Go to Flow Designer > Click New.

  • Name it something like: Copy RITM Attachments to SharePoint - Post Submission.

2. Trigger: Table = Attachment [sys_attachment]

  • Trigger condition:

    • When: Record is Inserted

    • Table: Attachment [sys_attachment]

3. Add a Condition to Filter Only RITM Attachments

  • Use a condition:

    • Table name is sc_req_item (or dynamically get the table name from the sys_attachment.table_name field).

4. Optional: Check for Post-Submission

  • You can add a condition to check that the RITM is already submitted:

    • Fetch the RITM record using the value from sys_attachment.table_sys_id

    • Then check RITM.state (e.g., not 'Draft' or 'New')

5. Copy Attachment to SharePoint

  • Use your existing logic/method (REST API, IntegrationHub, etc.) to:

    • Read the attachment content (use Attachment API)

    • Send to SharePoint document library using your integration.

 

if (current.table_name == 'sc_req_item')
{
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.table_sys_id) && ritm.state != '1')
{
// '1' = Draft/New // Continue to copy current (new) attachment to SharePoint
}
}
 

Please mark my answer as Accepted as Solution & hit helpful button if it helped you.

 

Thanks,

Pranesh072
Mega Sage

You have create a flow on sys_attachment table with trigger condition as table is sc_req_item. 

 

After that do a lookup on the sc_req_item with the record sys_id from attachment table and catalog item as your particular item.

 

You can remove the existing flow from sc_req_item table as all attachments can be handled via sys_attachment flow.

nityabans27
Kilo Patron

Hi @supriya pratapa ,

The best way to fix this is to create a new flow on the Attachment [sys_attachment] table.

  • Trigger: When a new attachment is created.

  • Condition: The Table Name is sc_req_item (or whichever catalog item you’re using).

  • Action: Use the same logic or subflow that uploads attachments to SharePoint.

This way, every time someone adds a new attachment to the RITM — even after submission — the file will automatically be copied to SharePoint.