- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 09:28 PM
I want to add tag 'Data Error' in cmdb_ci form through business rule...is it possible?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 10:09 PM
Change the sys_id of the label as per your need.
var addLabelGR = new GlideRecord('label_entry');
addLabelGR.initialize();
addLabelGR.label = '4336c042dbd6485046a579a58c9619dd'; //change the sys id of the label you want.
addLabelGR.table = 'tablename';
addLabelGR.table_key = 'sys ID of record';
addLabelGR.insert();
You can get the sys id of the label from label table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 10:14 PM
You can achieve this with the use of below piece of code in the Business rule script. Check the advanced checkbox and use the script in Advanced section.
gs.addInfoMessage("type the text message here");
kindly mark my answer as Correct and Helpful based on the Impact.
Regards,
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2020 10:09 PM
Change the sys_id of the label as per your need.
var addLabelGR = new GlideRecord('label_entry');
addLabelGR.initialize();
addLabelGR.label = '4336c042dbd6485046a579a58c9619dd'; //change the sys id of the label you want.
addLabelGR.table = 'tablename';
addLabelGR.table_key = 'sys ID of record';
addLabelGR.insert();
You can get the sys id of the label from label table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 04:32 AM
Hello Kalaiarasan,
How can we update the tag to multiple records on condition basis. suppose i want to update tag automatically if assignment group is something. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2023 10:56 AM
@Kumar147 wrote:Hello Kalaiarasan,
How can we update the tag to multiple records on condition basis. suppose i want to update tag automatically if assignment group is something. Thank you
To accomplish this, you would only need to build your GlideRecord query first, then iterate through each record and use Kalaiarasan's example above in the body of your while loop. For example, if you wanted to tag every active Incident record for a particular assignment group with a certain tag, you could do:
var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('assignment_group', 'sys id of the assignment group');
incidentGR.addActiveQuery();
incidentGR.query();
while(incidentGR.next()) {
var addLabelGR = new GlideRecord('label_entry');
addLabelGR.initialize();
addLabelGR.label = 'sys id of the label you want.';
addLabelGR.table = 'incident';
addLabelGR.table_key = incidentGR.sys_id;
addLabelGR.insert();
}