Error with setRequestBodyFromAttachment in REST message

Erdogan _zdemir
Giga Contributor

Hi,

When using the  setRequestBodyFromAttachment method for sending an attachment, I have an error.

In the Outbound Http log, I received a "[ERROR CODE: -1] attachment does not exist with sys_id: 9ad8e2a74b4a4110ffa2d68dbce058f8" message. I verify the attachment sys_id and it is correct.

In Google I did not find anything about this error. Maybe in the community, someone could help me.

Thanks,

Erdogan

1 ACCEPTED SOLUTION

Erdogan _zdemir
Giga Contributor

Hi all,

I found the problem of the message "[ERROR CODE: -1] attachment does not exist with sys_id:".

The mid user has no enough right on the sys_attachment table. I added the mid users role in the "read" ACLs  and it fixed the issue.

View solution in original post

5 REPLIES 5

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Erdogan,

Make sure it's the sys_id of the row in the sys_attachment table and not the value of the "table_sys_id" column.

If it is the sys_id is correct, it's probably the code. Would need to see the code to find the problem.

There's a sample code using setRequestBodyFromAttachment() in the following thread.

https://community.servicenow.com/community?id=community_question&sys_id=2da1ca041b99d0107a5933f2cd4b...

Erdogan _zdemir
Giga Contributor

Hi all,

After several tests, I remarked that the issue occured when I set the mid server in the rest call.

Now I am trying to send differently the attachment through a binary data. It is still in progress.. 

ersureshbe
Giga Sage
Giga Sage

Hi,

Per your error message, you should send the target instance sys_id of the ticket that is missing.

Per integration Source system should store the 3rd party system ticket id. That ticket id is a unique id of the target system. Whenever you send an attachment to the target system you should send the target system's unique id as well.

Regards,

Suresh.

 

Regards,
Suresh.