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
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

Community Alums
Not applicable

Hi @Arthur Sanchez  ,

Please try below script

var userRole = g_user.hasRole('x_1316384_ticket.ticket_manager');
	if (userRole){
		g_form.removeOption('state', <backend value of open>);
	}

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Captura de tela 2024-04-23 143553.pngCaptura de tela 2024-04-23 143612.pngFor some reason, it's not working, it doesn't remove/hide the option

Community Alums
Not applicable

Hi @Arthur Sanchez  .

I tried this script in my PDI it's working fine for me. Can you check that testing user have this role x_1316384_tickets.tickets_manager  if you are testing with your user you have to check like you have this role than only this option will hide for you

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Captura de tela 2024-04-23 145043.pngCaptura de tela 2024-04-23 145050.png

The manager has a role, otherwise he wouldn't even enter the application, what I don't understand is:
If the script is correct, and for you it worked and in your PDI it hid the "open" option
What's wrong with mine that it doesn't work?

Community Alums
Not applicable

Hi @Arthur Sanchez  ,

You can use below script 

g_form.removeOption('state', <backend value of state open>);

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak