Copy attachments to the variable's value in a table

Poorva Bhawsar
Mega Sage

Hi Community,

 

I want to copy attachments for variables value. 

 

Attachment added on database_oat_certificate variable should copy this attachment to the servers added in server_name_s variable.

 

Also, the attachments which are added on lot of variables on sctask table should copy the attachments to the application selected in business application table.

 

Here is the code.

 

var copyAtt = new GlideSysAttachment();
copyAtt.copy("sc_task", current.variables.database_oat_certificate,"cmdb_ci_server", current.variables.server_name_s);
copyAtt.copy("sc_task", current.sys_id, "cmdb_ci", current.variables.application_name);
 
Thanks,
Poorva Bhawsar
3 REPLIES 3

Jaspal Singh
Mega Patron
Mega Patron

Hi Poorva,

Thread already has a working solution proposed by Ankur.

I want to copy it based on some variables value.

No its not working. I want to copy it based on the variables value to those variables which i have added.