Restrict Changing of Priority

briansoucie
Kilo Contributor

Hello All,

I am not very well versed in scripting at all and I need some help from the community.

I am trying to restrict the lowering of a priority on incident tickets by technicians (which increases the SLA).

I have created a role that I will assign to the Team Managers and I want to allow them to change the priority.

I have looked through various postings and thought the screenshot of the client script below would work but I was wrong.

priority script.PNG

Error:

Priority error.PNG

We do NOT use impact and Urgency. We have 9 different Priorities (1-9)

So anyone (except a manager with the Team Manager role) would be unable to lower a priority and extend the SLA.

Increasing the priority would not be restricted.

Can anyone assist or is there a better way to do this?

Thanks in advance for your help.

7 REPLIES 7

Stephen,



I didn't see this until after I responded.



This WORKED!!!



Awesome help… Thank you


Good deal, glad I could help.



Don't forget to hit like, helpful or correct for my response and for future community members who have similar questions.


Stephen,



You helped.


That got rid of the errors. But wasn't functioning properly. Then I noticed some errors in my script and modified as shown below.


I then noticed that even if the person didn't have the role, when reducing the priority, the message appeared and it disallowed the change.



I appreciate all your help. You have been great



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading || newValue === '') {


return;


}


//Type appropriate comment here, and begin script below



var isTeamManager = g_user.hasRole('JR - Team Managers');


if (!g_form.isNewRecord() && oldValue < newValue && (!g_user.isTeamManagers))



{



alert('Your manager is required to lower the incident priority. Please contact your manager');



g_form.setValue('priority', oldValue);



return false;



}



else{



return;



}



}