Using GlideSysAttachment.copy and r.setRequestBodyFromAttachment(attach_sys_id);

Ibrahim Abduwah
Tera Contributor

I have a requiremnt to generate a request based on incidnt. I am able to do that no problem. Post successfuly creating the request. I run a business rule to copy the attachments form incident to sc_task task table. this is also seems to be working fine. "GlideSysAttachment.copy('incident', frm, 'sc_task', to);"

for some reason streaming from Copied file throws the following error with status 0.

Note that streamign frm a file uploaded to the task via interface does not have the same issue. Only streaming the file that has been copied seems to be having this issue. Please hlep.

 

com.glide.communications.InvalidContentLengthException: Incorrect Content-Length field
 var gr = new GlideRecord("sys_attachment");
            if (gr.get(attach_sys_id)) {
                var r = this.getRequestObj(request, mode);
                r.setRequestBodyFromAttachment(attach_sys_id);
                //  r.setStringParameterNoEscape('filename', fname);
                //  r.setStringParameter('filename',fname);
                //  r.setQueryParameter('filename',request.file_name);
                var response = r.execute();
                var httpStatus = response.getStatusCode();
                var responseBody = response.getBody();
                var parsed = JSON.parse(responseBody);
                this.isRespSuccess(response) ? this.linkFile(request, mode, parsed.url) : this.logerr(truethis.msg + responseBody);
            }

 

0 REPLIES 0