Flow Designer - Save REST response as attachment failing

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2020 06:50 AM
I'm trying to utilise the "Save as attachment" option in a REST step within a flow designer action. I've configured all of the fields (attachment name, parent document) but when run I get the following error;
Error encountered while creating Attachment. Error creating Attachment thumbnail.jpg : Method failed: (/api/now/v1/attachment/file) with code: 403 - Forbidden username/password combo
Additionally, this REST call is running via the MID server as the end point is on the local network. It works fine if the MID server is not used and a web accessible URL is accessed.
I'm clearly missing some authentication record somewhere but for the life of me I can't work out where.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2020 07:56 AM
So this was simply down to access to the sys_attachment table. Adding an ACL for the mid_server role to be able to create records fixed the issue. This was done within the scoped app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 05:59 AM
Is there anything specific you had to do for the ACL? I tried this and i am still getting the 403 error even with ACLs created for the sys_attachment table. I created two on create and two on write for mid_server role.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 01:18 AM - edited 05-24-2023 01:36 AM
I'm kicking myself as I've reset my instance and now I can't recreate the solution either!
Things I've tried;
- add write/create ACL's to sys_attachment for mid_server role
- add the snc_platform_rest_api_access role to my mid_server account
Still getting the 403 error. I'll keep trying and let you know if I find the solution again.
Right, I have it working again and it's down to access to the table you are trying to add the attachment to. For example, if I'm using "Incident" as the target table then the mid_server role needs at least write access to the table. You may still see the following error;
Operation(Test REST./end) failed with error: com.snc.process_flow.exception.ProcessAutomationException: Error encountered while creating Attachment. Error creating Attachment test.txt : JSONObject["sys_id"] not found.
But that doesn't stop the attachment being created, however adding read access to the table will resolve that error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 05:49 AM
Ahhh, that worked! great. I was getting a similar error "Error encountered while creating Attachment. Error creating Attachment tufin : JSONObject["result"] not found." but what i did was changed my attachment file name to .txt and that solved it.