- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 08:39 PM
HI All,
I need to create a Business rule that would check if opened by is member of Service Desk then set field values of assigned to, to the user who opened the ticket and assignment group to Service Desk.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 03:17 AM
Write a Display BR to check if the the logged in User is member of group or not.
g_scratchpad.membership = gs.getUser().isMemberOf('Service Desk');
Then you can create an onLoad client script and Use the following code:
function onLoad() {
if (g_form.isNewRecord()) {
if (g_scratchpad.membership) {
g_form.setValue('assignment_group', 'sys id of ServiceDesk group');
g_form.setValue('assigned_to', g_user.userID);
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 08:43 PM
If you want to set a static assigned to and assignment group value, below is the code.
Use a Before insert business rule for this:
current.assigned_to = 'anyUserID';
current.assignment_group = 'anyGroupID';
However, ServiceNow has made life easier with Assignment Rules.
Go to this module called Assignment Rules , select your table as incident and set your assignment group and assigned to.
Long Live ServiceNow!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2021 10:40 PM
Hi Anirudh,
Thanks for your reply mate, however a bit confused with setting static assigned to values. What I am hoping to achieve is when New incident form is loaded, business rule should check if current user or user who is creating the incident is member of Service Desk group.
If user is member of the group then set assigned_to, to opened by user and assignment group to service desk, if its not true then leave both the fields emply.
I am not really good with scripting as yet so was hoping if someone had done this in the past and would be able to share how they achieved it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 03:17 AM
Write a Display BR to check if the the logged in User is member of group or not.
g_scratchpad.membership = gs.getUser().isMemberOf('Service Desk');
Then you can create an onLoad client script and Use the following code:
function onLoad() {
if (g_form.isNewRecord()) {
if (g_scratchpad.membership) {
g_form.setValue('assignment_group', 'sys id of ServiceDesk group');
g_form.setValue('assigned_to', g_user.userID);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2021 05:13 AM
Perfect, exactly what I was looking for, thanks for your help mate 🙂