Business Rule Not Working for Specified Role

Sofija
Giga Expert

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:

Capture.PNG

Capture.PNG

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.

1 ACCEPTED SOLUTION

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.


View solution in original post

34 REPLIES 34

I just tried your example and it didnt work for me... See screenshot below. Assignment group was blank when I pressed 'create new' incident. My goal was to have assignment group default to 'IT INF Service Desk' when a user from that group click/opens 'create new' incident form.


Capture.PNG


Okay..It will work currently only if you save the record...Was not sure if your req is to have as soon the user clicks the new record. Let me modify it.


You can use the WHEN:DISPLAY business rule you had previously but with no filter conditions, only this condition and script.   Will probably still run on admins unless you do an && !gs.hasRole('admin') in the condition as well.   The problem before was checking the opened_by which doesn't actually hold a value yet until after creation, so instead this look at whoever's current session it is.


Capture.JPG


Gurpreet07
Mega Sage

As i mentioned earlier , Role Conditions need to be removed and check for roles of opened by user in dynamic filter script.


That's exactly what I did but it didnt work for me..