- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 04:12 AM
Hi everyone
I'm a beginner in ServiceNow development, currently learning the Incident Management module.
I would like to create a 'business rule' that automatically sets the 'Assignment Group' when the 'Category'is "Hardware".
Here’s what I’ve tried so far:
```javascript
if (current.category == "hardware") {
current.assignment_group = "Hardware Support";
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 04:36 AM - edited 07-21-2025 04:39 AM
Hi @DaramK ,
Script is not required for this however as you are new you need to know fe things. As "assignment_group" is a reference field you need to pass the "sys_id" of the assignmnet group. So, as Servicenow best practice we will not hardcode any sys_id in a code. So you need to store the sys_id of the group in a system property and call it in a business rule. Below are the steps to do it:
1. Open the required group record > right click on top of the headermenu > copy the sys_id
2. Go to System Properties > Create New > provide the name as you wish example "x_incident.group" > Type as string > and value will be the copied sys_id.
3. Below is the Business rule:
if (current.category == 'hardware') {
var groupSysId = gs.getProperty('x_incident.group');
if (groupSysId) {
current.assignment_group = groupSysId;
}
If my response helped please mark it correct or Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 04:37 AM - edited 07-21-2025 04:41 AM
no scripting required.
you can use before insert/update business rule
Condition: Category == Hardware
Use Set Field Values Tab and set the group
Something like this
OR
In your above script set the group sysId
if (current.category == "hardware") {
current.assignment_group = "groupSysId";
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 04:36 AM - edited 07-21-2025 04:39 AM
Hi @DaramK ,
Script is not required for this however as you are new you need to know fe things. As "assignment_group" is a reference field you need to pass the "sys_id" of the assignmnet group. So, as Servicenow best practice we will not hardcode any sys_id in a code. So you need to store the sys_id of the group in a system property and call it in a business rule. Below are the steps to do it:
1. Open the required group record > right click on top of the headermenu > copy the sys_id
2. Go to System Properties > Create New > provide the name as you wish example "x_incident.group" > Type as string > and value will be the copied sys_id.
3. Below is the Business rule:
if (current.category == 'hardware') {
var groupSysId = gs.getProperty('x_incident.group');
if (groupSysId) {
current.assignment_group = groupSysId;
}
If my response helped please mark it correct or Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 04:37 AM - edited 07-21-2025 04:41 AM
no scripting required.
you can use before insert/update business rule
Condition: Category == Hardware
Use Set Field Values Tab and set the group
Something like this
OR
In your above script set the group sysId
if (current.category == "hardware") {
current.assignment_group = "groupSysId";
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader