Auto populate the Assignment group based on cmdb class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 10:30 PM
Hi All,
I have a requirement.If I select the causing ci in the problem table and that ci is related to specific cmdb class then the assignment group should be auto populated .
ex:If cmdb class name =generic and then if I select any ci item of that class the assignment group should be auto populated as problem management group.
please Help
Thanks
Saikumar
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 10:46 PM
Hi,
Try writing a OnChange client script, which invokes when you select the CI on form.
It calls a Script Include. Which you use to get CMDB class name and and similarly fetch the assignment group in there.
return the group value and in the client script set the returned value in 'group' field.
Let me know in case of any concerns.
Please mark the answer helpful/correct based on impact!
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 10:52 PM
can you please provide script .I am new to servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 10:55 PM
You can try the Before Business rule without scripting if you're looking for specific Class name
Condition
First click Show related and Choose Configuration Item -> Configuration Item Fields -> Class
For example, i have taken a server class you can choose as per your requirement
ACTIONS
Choose Group as per your requirement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2022 10:59 PM
If you want dynamic try the same Business rule
condition
SCRIPT
(function executeRule(current, previous /*null when async*/) {
if(current.cmdb_ci.sys_class_name){
current.setValue('assignment_group', 'group_sys_id') //If you want to choose group from cmdb_ci record you can do as Dot-walking current.cmdb_ci.group_field_name
}
})(current, previous);