Incident Query Business Rule

Allison3
Kilo Guru

I've created a new role called itil_limited. This will be used to give access to some itil users that only need access to incident and requests. I've matched all the similar appropriate applications, modules, and ACL's.

When I go in as someone with the rule I don't have access to any incidents. I think this has to do with the Incident query business rule but I'm not sure how to update it.

Capture.JPG

Can anyone tell me what I would need to add to this business rule to get the itil_limited role to view incidents?

I created a new rule just like the incident query one and changed the itil rule to itil_limited but It didn't resolve the issue. I think the business rules might have been conflicting.

4 REPLIES 4

srinivasthelu
Tera Guru

Hi Allison,



You need to update the incident query BR.



if( !gs.hasRole("itil") && gs.isInteractive())   to




if (!gs.hasRole("itil_limited")&& !gs.hasRole("itil") && gs.isInteractive())


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Allison,



Just to add, Please go through the below link for more info.


http://www.servicenowguru.com/scripting/business-rules-scripting/controlling-record-access-before-qu...


Hi Pradeep,

Good morning,

Could you please have a look at my below requirement and suggest the solution.

I have written the query business rule but itis not working.

 

I have one requirement, could you please have a look and help me with steps and code for better understanding.

I have created one ABC group and XYZ service, now my requirement:

Condition : If any Incident gets created on XYZ service then - 

1) Anyone can create incident/change/request records using XYZ service but only record creator and member of ABC group can view the records.

2) ABC is support group of XYZ, so only members of ABC can modify and work on the records.

3) If possible even system admin can not see the records. (I unchecked the Admin Override in when created Write ACL with Type is Record)

 

My code:

(function executeRule(current, previous /*null when async*/) {
if(gs.getUser().isMemberOf('Human resource')&&(gs.getSession().isInteractive()))
{
var u = gs.getUserID();
current.addQuery('business_service', 'HR').addOrCondition('opened_by','u');
//.addOrCondition(gs.getUser().isMemberOf('Human resource'));
//.addOrCondition('business_service','==','4e4aabd0db033340d68c5c00cf961995'); 

}
})(current, previous);

 

Also for 2nd and 3rd requirement , I have created write ACL as shown below but this is not working as well.

Type : Record , Admin Override box: Not checked, Condition: Business Service IS HR (When the service is HR then only this ACL should get applied)

Code: 

answer=false;
if(gs.getUser().isMemberOf('Human resource'))
{
answer=true;
}

Kalaiarasan Pus
Giga Sage

You can combine both the conditions in one business rule. Also check if any ACL is blocking the access to the table.