Choice list to show depending upon Roles

Vignesh21
Kilo Guru

HI,

Use case: We have a choice list which has 5 values and i have given on load client script to remove option from the choice list depending upon roles. This is working fine on the form. But on the list view i am able to see all the choice values.

Is there a way we could hide the values on list view depending upon roles.

-Vignesh

1 ACCEPTED SOLUTION

Henrik Jutterst
Tera Guru

I would suggest a new Client Script that runs onLoad.

 

function onLoad() {
	//who to display it for - admin
	var isAdmin = g_user.hasRole('admin');

	if (!isAdmin){
		g_form.removeOption('contact_type', 'integration');
	}
}

View solution in original post

19 REPLIES 19

Siddartha Gudim
Tera Guru

The best option would be restricting the users from being able to edit the field from the list view. I have searched for potential solutions but was left with this.



Please like or mark correct based on the impact of the response.


Siddartha, the use case clearly mentions that they want end users with certain roles to perform the activity on list view and they should not see all the values which is there in the choice list.


Chuck Tomasi
Tera Patron

There is a client script type onCellEdit. You could try using the same "remove" logic in that as your onLoad script.


@chuck Thanks for your response. I tried the doing it onCelledit and it didnt work.



When i view the list in the form i see the below 2 values:


find_real_file.png



but when i see the values from list view i still get all value.


find_real_file.png