Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to modify the state view

Arthur Sanchez
Giga Guru

Captura de tela 2024-04-23 131542.png

I have an application where there is a user, support and manager. When 1 ticket is created by the user, the default state is open and I change it to pending with flow

But how do I hide the open option? I still want to keep this option so I don't have to change the flow, but I want support to only be able to see the pending, worik in progress, closed complete and re-open options

Is there any way to do this?
1 ACCEPTED SOLUTION

swathisarang98
Giga Sage

Hi @Arthur Sanchez  ,

 

You can try something as below,

 

 

function onLoad() {
   var checkRole = g_user.hasRole('x_1316384_tickets.tickets_manager');
 //  alert(checkRole);
   if (checkRole == true){
	g_form.removeOption('state','1');  // in place of '1' please add the backend value oof choice Open
   }
   
}

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

11 REPLIES 11

swathisarang98
Giga Sage

Hi @Arthur Sanchez  ,

 

You can try something as below,

 

 

function onLoad() {
   var checkRole = g_user.hasRole('x_1316384_tickets.tickets_manager');
 //  alert(checkRole);
   if (checkRole == true){
	g_form.removeOption('state','1');  // in place of '1' please add the backend value oof choice Open
   }
   
}

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

IT WORKED