i want to restrict the users to create and update p1 and p2 tickets

chinna
Mega Guru

Hi Team,

i have a requirement like, i want to restrict the users to create and update the p1 and p2 tickets.

only 2 groups people only able to create and update the tickets.

how can i achieve this. can anyone help me on this with a script.

may be acl is works for this.

 

regards,

chinna

9 REPLIES 9

Its not removing the option, its just hiding from them

Thank you,
Abhishek Gardade

rajesh9885
Mega Guru

Hello

You can use a BR for this

it would be something like this

On before script and in condition select priority is one of(p1,p2)

var permitted_groups =[<group sys_id>];

 var flag = false;
 var group_count = permitted_groups.length;
for (var i=0; i< group_count ; i++){
 if(gs.getUser().isMemberOf(permitted_groups[i]))
   { flag = true;
     break;
   }
}
              

if(!flag)                                                          
 {
                  gs.addErrorMessage('You are not authorised to create Incident with Priority P0/P1.');               
                  current.setAbortAction(true);
  }


      

Ajay_Chavan
Kilo Sage

Hi Chinna

Create a BR which will run on Before Update : 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	if ((!gs.getUser().isMemberOf("group 1") || !gs.getUser().isMemberOf("group 2")) && (current.getValue('priority') == '1' || current.getValue('priority') == '1'))
		{ 
			gs.addErrorMessage('you dont have the right to update P1 and P2 tickets');
			current.setAbortAction(true);
		}

})(current, previous);

 

Mark correct if this resolves ur query

 

regards,

ajay

Glad I could help! If this solved your issue, please mark it as Helpful and Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

Satyanarayana C
ServiceNow Employee
ServiceNow Employee
  • Restricting the user to create P1 tickets
    • Create an onChange client script,
    • This script will make an Ajax call to a script include
    • Verify if the user belongs to the group
    • Based on the response, show a message and take appropriate actions
  • Restricting the user to Update P1 tickets
    • This can be achieved using ACL
    • Write an ACL script that returns false if the user does not belong to the group

 

suseelalingam
Tera Contributor

I have a query , only some users we need to provide the access to create P1 incidents. If not we need to send a alert message and revert the impact and urgency to pervious values using Client script.