We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Flow Designer not adding attachment

stayyaba
Tera Expert

I have built a flow designer that copies all the attachments from RITM to task.

The catalog item and workflow belongs to a custom scope, I am using the below following three steps to copy attachment:

  1. Look up RITM attachment record in sys_attachment table, to fetch list of sys ID's.
  2. Running a for each loop on above action to fetch the comma separated sys IDs one at a time.
  3. Using Copy Attachment action to copy attachment from source to target record, which is task.

I understand that its not an issue with this logic because I am able to make it work in Dev instance. When I promoted it to TEST instance for UAT, its causing issues there, by throwing the error as : 

Error: undefined is not a function.,Detail: undefined is not a function.

 

Initially there was a cross scope issue, where read privilege was missing for sys_attachment table. I later provided that, but its still not working in Test.

 

Troubleshooting done:

 

  • Inactive and re-active the flow in test.
  • Recapturing and pushing the update set back from Dev to Test after providing Cross scope Read privilege in Test.
  • Creating a flow from scratch in Test just to test if it works with the new flow. 

Nothings seems to be working, kindly help.

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@stayyaba 

you are saying it's working in dev but not in test. Did you check everything got captured and migrated to test?

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

View solution in original post

stayyaba
Tera Expert

The issue got fixed, it was an issue with cross scope permissions.

View solution in original post

6 REPLIES 6

stayyaba
Tera Expert

The issue got fixed, it was an issue with cross scope permissions.

Ben Rowny
Tera Guru

Since the original author did not detail the issue they had with Cross Scope permissions.... if your Flow is running in a Scoped App, you may need to set up Cross-Scope Application Access for a couple APIs used by the OOTB Copy Attachment flow action.  For me I needed to add two, with the following settings:

  • Source Scope: [Your App Scope]
  • Target Scope: Global
  • Target Type: Script Include
  • Target Name:
    • 1. AttachmentActionsUtil
    • 2. AttachmentActionErrorHandler
  • Operation: Execute API
  • Status: Allowed