Only new state visible when creating new incidents

Christian22A
Tera Contributor

What is the best approach to limit all users other than admins to only be able to save/submit new incidents in a new state?  The options to change the state to in progress, on hold, resolved or cancelled should not be visible until after the creation of an incident.

1 ACCEPTED SOLUTION

something like this in an onload client script

 

if(!g_user.hasRole('admin') && g_form.isnNewRecord())
{
// set value of state or make it read only
g_form.setValue('state', 1);
g_form.setReadOnly('state', true);
}

 

 

-Anurag

View solution in original post

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

HI,

You can just hide the state , when user is not admin && incident is new, you can do so via client script.

Will that work for you?

 

-Anurag

something like this in an onload client script

 

if(!g_user.hasRole('admin') && g_form.isnNewRecord())
{
// set value of state or make it read only
g_form.setValue('state', 1);
g_form.setReadOnly('state', true);
}

 

 

-Anurag

Killing it...  Experience.... 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Christian22A 

 

I am not 100% agree, as this is required to modify the basic functionality of system. If you want to do , you can use BR to hide the rest of state.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************