- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 04:23 AM
Hello! I feel a little stuck with a business rule which does not seem to be running correctly, and would appreciate your help.
My objective was to create a BS on Incident form that would default Assignment Group based on the role Opened by user had. I did create a role called itil_servicedesk and assigned to certain groups. I also created the following BS rule:
However, once I go on to test the functionality works only for me as an admin (though I am dont have itil_servicedesk) role, but does not work for the groups that have the itil_servicedesk role. Any ideas why? I would like it to work only for itil_servicedesk role and it should not work for admins.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 06:25 AM
Ok..I've constructed an example in the below demo link where it is working. Please check for reference.
Business rule name : check role
https://demo007.service-now.com/login.do
Username : admin
Password : admin
Steps for testing : Impersonate as a user "Abel tuter"
Basically it will set the assignment group to "Database" if the opened by has the group "Cab approval".
For demo purpose I've made "Abel tuter" the member of the group.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 05:23 AM
Hi Kamile,
So is your req is to check that user with role iti_servicedesk should have assignment group "IT INF Service Desk". Please confirm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 05:49 AM
Pradeep,
Requirement is to default assignment group field on new incident form to 'IT INF Service Desk' if opened by is the user from 'IT INF Service Desk' group.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 05:56 AM
Thanks Kamile for the update. Can you try the below script and let me know the outcome.
Create a business rule of type before and check insert has true.
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group.name','YOUR GROUP NAME');
gr.addQuery('user', current.opened_by);
gr.query();
while(gr.next())
{
current.assignment_group = 'SYSID of the Group you want to set';
}
Please take the update script above. There was a small correction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 06:15 AM
Since she's using the Filter-Builder I'm going to assume she doesn't have much coding experience so I'll customize that a bit to fit her needs:
And Kamile, so remove your current Conditions altogether and make sure it's not When: Display, but instead do When: Before, and check the box for Insert so it'll run before an insert... i'm assuming that's the only time this would be necessary since the opened_by shouldn't really be changing after the insert.
checkForITILservicedesk();
function checkForITILservicedesk(){
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', 'itil_servicedesk');
gr.addQuery('user', current.opened_by);
gr.query();
if (gr.hasNext()){
current.assignment_group.setDisplayValue('IT INF Service Desk');
//or current.assignment_group = 'sysid string of that queue';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2015 06:23 AM
The WHEN: DISPLAY isn't working on very new records because technically they don't have an Opened_By yet. It populates that on the client side. So you'd either have to use a Client Script to also populate the Assignment Group if that's required or have the above WHEN: BEFORE business rule just clean it up for them after they hit submit.