Restrict dropdown values in list view for incident

Tharun15
Tera Contributor

Hi All,

how we can restrict dropdown values in the list view

Table: Incident

Field: State

Field value ‘Closed’ should be visible only for Admin user in both form view and list view (In form view, this is already in place, need to do it in list view as well).

 

Regards,

Tharun

1 ACCEPTED SOLUTION

Hi,

So only admins should be able to change State to closed

update BR condition as this

current.state == 7 && !gs.hasRole('admin')

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Hi Ankur,

 

yes,

 

i will correct it. 

thanks for your help.

 

but below code is not work. please check and get back me.

 

Thanks,

Tharun

Hi,

You cannot hide choice value from list

You can restrict the value using onCell Edit

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

How we can write the code oncell edit.

 

Regards,

Tharun

Did you accidentally marked your own response as correct?

Would you mind marking my response as correct if I was able to help you

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

I already shared the script above

Sharing again

onCell Edit Client Script example

Table - your table

Field - State

Script:

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

	var saveAndClose = true;
	//Type appropriate comment here, and begin script below
	var isAdmin = g_user.hasRole('admin');
	if (!isAdmin && newValue == '3'){
		alert('Not allowed to set this state');
		saveAndClose = false;
	}
	callback(saveAndClose);
}

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader