- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2018 10:43 PM
Hi,
I've been having trouble with migrating all of my attachments of a particular table to another instance (From Helsinki to Kingston). I have used the REST attachment API (POST) and created a scheduled job script to run but not all attachments are moved.
REST message:
Script used:
Results are as follow:
I went over to manually attach the particular file and was able to do so. However, I am unable to attach via REST api of another instance.
As I have posted another issue possibly similar to this, I've decided to remove it and edit it onto this post as it may be related.
Any ideas on where did I go wrong or know the solution to the attachment extension issue?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 05:42 AM
Joel,
If your target instance returns 404, isn't it simply because the record you are trying to attach the file to doesn't exist on this instance with this table_sys_id ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 12:03 AM
Joel,
Can you try adding some gs.log to debug your script? Make sure your first grAttach GlideRecord finds the record and provides all the correct values to your sendAttachment function.
Also, add a try/catch on the setRequestBodyFromAttachment call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 01:46 AM
Hi,
I did a log for response, http status and the response body. I've logged down all grAttach variables and was able to view them. Even if the status is 404, I am able to obtain the information of variable taken from grAttach.
I did a try/catch but it wasn't returning any exception.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 05:42 AM
Joel,
If your target instance returns 404, isn't it simply because the record you are trying to attach the file to doesn't exist on this instance with this table_sys_id ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 07:28 AM
I was hoping that would be the case. But unfortunately, the record exist.
I can't export them via xml it is over 32GB of data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2018 08:40 AM
AH! My REST api to migrate the table records must have screwed up somehow, affecting the sys id of some records in this case.
Like you mentioned, record exist but the sys id is different.
Thank you!