We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Copy tags from one table to another

Utkarsha
Tera Contributor

Hello All,

I am using below query BR to copy tags from one table to another, but currently all records from the target table are getting updated I want only the associated record should have the tag copied from source record which has new tag added.

Please suggest any changes here,

Thank you,

 

After insert BR-label_entry table

if (current.operation() == 'insert'){
 
var controlObjRec = new GlideRecord('sn_compliance_control');
controlObjRec.addEncodedQuery('content='+current.table_key+'^source_listISNOTEMPTY');
controlObjRec.query();
while(controlObjRec.next())
{

var tagRec = new GlideRecord('label_entry');
tagRec.initialize();
tagRec.table='sn_compliance_control';
tagRec.table_key=controlObjRec.sys_id;
tagRec.label=current.label;
tagRec.title=controlObjRec.name;
tagRec.read='yes';
tagRec.insert();

}
var control = new GlideRecord('control_test');
control.addEncodedQuery('content='+current.table_key+'^source_listISNOTEMPTY');
control.query();
while(control.next())
{

var tagPec = new GlideRecord('label_entry');
tagPec.initialize();
tagPec.table='control_test';
tagPec.table_key=control.sys_id;
tagPec.label=current.label;
tagPec.title=control.name;
tagPec.read='yes';
tagPec.insert();

}

 

0 REPLIES 0