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 Attachments

Reena Kumari2
Tera Contributor

Hi Community,

 

I just want to copy the attachments from demand to project , whenever a new project is created.

Any help will be appreciated.

 

Thanks,

Reena Kumari

 

1 ACCEPTED SOLUTION

Weird
Mega Sage

After the project is created (After BR) you can use this to copy attachments from record X to record Y:

GlideSysAttachment.copy('incident', 'sys_id_of_source',' incident', 'sys_id_of_target');

 You state the source table and sys_id and the target table and sys_id and it'll copy the attachments to the target record from the source. So in this case your project should have a reference to the demand and you could have a after insert BR on your project table with the following script:

GlideSysAttachment.copy('dmn_demand', current.getValue('demand'), 'pm_project', current.getUniqueValue());

 

View solution in original post

2 REPLIES 2

Weird
Mega Sage

After the project is created (After BR) you can use this to copy attachments from record X to record Y:

GlideSysAttachment.copy('incident', 'sys_id_of_source',' incident', 'sys_id_of_target');

 You state the source table and sys_id and the target table and sys_id and it'll copy the attachments to the target record from the source. So in this case your project should have a reference to the demand and you could have a after insert BR on your project table with the following script:

GlideSysAttachment.copy('dmn_demand', current.getValue('demand'), 'pm_project', current.getUniqueValue());

 

Reena Kumari2
Tera Contributor

Hi Weird, it's working. Thanks for your response.