Copy tags from one table to another
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 06:11 AM - edited 10-10-2023 06:16 AM
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