Hi,

Since that is your custom table and attachment you can use that same script in the UI action itself

your UI action code would look something like this

GlideSysAttachment.copy(current.getTableName(), current.sys_id, 'sys_data_source', '<dataSourceSysId>');

var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "<RecordSysId>"); // sys_id of the record which you will be creating for scheduled import in step (a)
exportGr.query();
if (exportGr.next()) {
gs.executeNow(exportGr); // this is for scoped app
// SncTriggerSynchronizer.executeNow(schImp_GR); // this is for non scoped app
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader