Facing corrupted file while downloading copied attachment

Sinha_Shubhali
Tera Contributor

Hi Everyone,

 

We have a Business rule which copy the attachments from RITM to SCTask using the 'GlideSysAttachment'. Users are able to download the file from the RITM but facing issues when try to download copy of same file from SCTask. The downloaded file from SCTask has 0KB size and when open it, it's showing 'Failed to load PDF document' on chrome and 'Something went wrong' on the edge. I checked the sys_attachment table and and both the attachments on RITM and SCTask have same size bytes, status and size compressed details. Could anyone please help?

 

Thanks,

Shubhali

3 REPLIES 3

iekosmadakis
Mega Sage

Hello @Sinha_Shubhali !
Could you please share the code from the Business Rule that's handling the attachment copy? That will help us troubleshoot the issue more effectively.


Hi @iekosmadakis,

 

Thanks for the response. This is the code of the BR. It's an after BR with order 100 and table is 'sc_task'.

 

GlideSysAttachment.copy('sc_req_item', current.request_item, 'sc_task', current.sys_id);
 
Thanks,
Shubhali

dora88flora
Mega Contributor

@Sinha_Shubhali wrote:

Hi Everyone,

 

We have a Business rule which copy the attachments from RITM to SCTask using the 'GlideSysAttachment'. Users are able to download the file from the RITM but facing issues when try to download copy of same file from SCTask. The downloaded file from SCTask has 0KB size and when open it, it's showing 'Failed to load PDF document' on chrome and 'Something went wrong' on the edge. I checked the sys_attachment table and and both the attachments on RITM and SCTask have same size bytes, status and size compressed details. Could anyone please help?

 

Thanks,

Shubhali


It looks like the attachments aren't copying correctly using GlideSysAttachment. Even though the file sizes match in sys_attachment, the copied file from SCTask is unreadable. Possible causes include encoding issues, MIME type mismatches, security restrictions, or incorrect API usage. You could try alternative copying methods like AttachmentCreator with ecc_queue. Checking system properties related to file handling might also help.