Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2023 03:01 AM
Hi,
I have a requirement,
A) A Business Rule will be created to auto-populate and update data into new records when the record is created or migrated into the {Network Appliance Hardwares} [cmdb_ci_net_app_server] table, with the below conditions.
1) WHEN the [Name] contains "POLY":
a) The [Managed By Group] field will be populated as: "SP-Video-Conferencing"
b) The [Support Group] field will be populated as: "SP-Video-Conferencing"
c) The [Owned By] field will be populated as the [Manager] of Group: [SP-Video-Conferencing]
B) A Business Rule will be created to auto-populate and update data into existing records on the the {Network Appliance Hardwares} [cmdb_ci_net_app_server] table WHEN there is an update to the record [Manager] changes in group: [SP-Video-Conferencing].
1) WHEN the [Name] contains "POLY":
a) The [Owned By] field will be updated to the new [Manager] of Group: [SP-Video-Conferencing]
Please help me with the script....How we can achieve this
Thanks in Advance
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2023 07:45 AM
Hi suuriya,
You'll want to use two different business rules to accomplish this. Refer to attachments (of course your sys_ids will differ so you'll want to update accordingly).
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2023 07:45 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2023 12:59 AM
For First case i tried with this script
(function executeRule(current, previous /*null when async*/) {
var name_contains_poly_lowercase =current.name.toLowerCase();
var name_contains_poly = name_contains_poly_lowercase.indexOf("poly");
var gr_server = new GlideRecord("cmdb_ci_net_app_server");
gr_server.addQuery('sys_id',current.sys_id);
gr_server.query();
if(gr_server.next())
{
if (name_contains_poly!=-1)
{
gr_server.managed_by_group ="5283669d9cf6200000dd41eb0f5c1dfa";
gr_server.support_group = "5283669d9cf6200000dd41eb0f5c1dfa";
gr_server.owned_by = gr_server.managed_by_group.manager;
gr_server.update();
}
}
})(current, previous);