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

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@supriya pratapa 

make a flow trigger on Record insert on sys_attachment and condition as

Table Name = sc_req_item

Then in that flow handle the logic to push the file to sharepoint.

I will recommend creating a reusable subflow so that you can use that from this newly created flow and also from your earlier flow.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

In the trigger condition, I’m unable to limit execution to only my item because the RITM sys_id is stored as plain text, preventing me to retrieve the item name.

@supriya pratapa 

which trigger condition? the new flow you are saying?

In that you can use Lookup Record on RITM table and see the RITM belongs to which Catalog item

if it's yours then push file to Sharepoint

If not then end your flow

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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,