Inactive records on incident need to be visible to itil role users only.

manoj1
Tera Contributor

Inactive records on incident need to be visible to ITIL role users only.

6 REPLIES 6

Amit Gujarathi
Giga Sage
Giga Sage

HI @manoj1 ,
I trust you are doing great.

  1. Create a new field on the Incident table to mark the record as inactive. Let's call this field "Inactive" (type: Boolean).

  2. Define the ITIL role in ServiceNow if it doesn't exist already. You can do this by navigating to "User Administration" -> "Roles" and creating a new role named "ITIL".

  3. In the Business Rule script, add a condition to check if the incident record is inactive and the current user has the ITIL role. If the condition is met, set the "Inactive" field to true; otherwise, set it to false. Here's an example of how the code could look:

 

(function executeRule(current, previous /*,...*/) {
  if (current.active == false && gs.hasRole('itil')) {
    current.inactive = true;
  } else {
    current.inactive = false;
  }
})(current, previous /*, ...*/);

 

  1. Create a new filter on the Incident table to display only inactive records. In the filter conditions, add a condition to check if the "Inactive" field is true. This will ensure that only inactive incidents are displayed in this filter.

  2. Assign the new filter to the ITIL role users. This can be done by navigating to "System Definition" -> "Dictionary" -> "Attributes", finding the "Filter" attribute of the "sys_user_role" table, and adding the newly created filter to the ITIL role.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi Amit,

 

Thanks for asking.

 

I am doing good hope you are also doing great.

 

can you help me which business rule do we need to use.

Ankur Bawiskar
Tera Patron
Tera Patron

@manoj1 

is this a customer requirement?

you can update the code in OOB query business rule for the same.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

yes this is customer requirment.

 

can you please me with the OOB query business rule name.