Sudhanshu Talw1
Tera Guru

try this:

Create After business rule on "sys_attachment" table, operation would be "INSERT", use the business rule condition Table Name | IS | sc_req_item table.

 

copyAttachments(current);

function copyAttachments(attachment) {
	var tasks = new GlideRecord("sc_task");
	tasks.addActiveQuery();
	tasks.addQuery('request_item', current.table_sys_id);
	tasks.query();
	while(tasks.next()) {
		gs.log('Copying attachment for task ' + tasks.number, 'ServiceNow Community');
		var gsa = new GlideSysAttachment();
		gsa.copy(current.table_name, current.table_sys_id, tasks.getTableName(), tasks.sys_id);
	}
}

//The above one will work otheriwse this one also works 

(function executeRule(current, previous /*null when async*/) {

            var gr = new GlideRecord('sys_attachment');

            gr.addQuery('table_sys_id',current.sys_id);

            gr.query();

            if (!gr.hasNext())

            {

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

            }

  })(current, previous);​

 

https://community.servicenow.com/community?id=community_question&sys_id=78bb2c64db87d74423f4a345ca96...