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

Ramz
Mega Sage

Hi @Arthur Sanchez  ,

 

You can use onLoad client script.You can add if conditions according to your requirement.I am assuming support is a user on the form.So if logged in user is a support user then remove option 'pending' .

 

g_form.removeOption('state', 5);//assuming 5 is the backend value of pending state

Please mark my answer helpful if it resolved your query.Thanks!

 

For some reason, it's not working, it doesn't remove/hide the option

Captura de tela 2024-04-23 143553.pngCaptura de tela 2024-04-23 143612.png

Sid_Takali
Kilo Patron
Kilo Patron

Hi @Arthur Sanchez   write onLoad Client Script modify accordingly

 

function onLoad() {
	//check logged in user role
	var isAdmin = g_user.hasRole('admin');
	if (!isAdmin){
		g_form.removeOption('state', 'pending');
	}
}

 

 

If my answer is helpful  please mark it as helpful or correct!

Regards,

Siddharam

I want to remove the "open" state for some roles like: x_1316384_tickets.tickets_manager

I copied your code but it doesn't work

Captura de tela 2024-04-23 142241.pngCaptura de tela 2024-04-23 142442.pngCaptura de tela 2024-04-23 142531.png