Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

copy attachemnet in scoped application

deepak50
Tera Contributor

Hi,

I am working on a scoped application and need to copy attachments from case record to incident record.

I tried GlideSysAttachment.copy() and GlideSysAttachment.writeContentStream() methods in script include but these are not working.

Both of these methods are working If I write the same code in background script.

Is there a way to copy attachments from one record to other in scoped application.

 

Thanks

Deepak

6 REPLIES 6

deepak50
Tera Contributor

Hi,

Yes sysIds are correct. I hardcoded sysIds in function , still this is not working. I also tried to get sysIds from Case and Incident number using Gliderecord API and pass in function , it also did not work.

I am calling this script include function from Inbound Email Action, As I checked in logs this script include method is executed with correct input but attachments not copied.

While I call this function from background script , It is working . It is copying attachments from case to incident record.

 

 

 

I think there should be some warning or error in your system logs. Kindly check.

If possible share the complete inbound action that is running this code.