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

Michael Jones -
Giga Sage

You can't remove the option from the list view, unfortunately. 

Your best bet would be to create an ACL to prevent editing the state field from the list. This post gives you the idea, you'd just need to set it for that single field instead of the whole table. 

https://community.servicenow.com/community?id=community_question&sys_id=3d16cb61db1cdbc01dcaf3231f96...

Otherwise you could create a before business rule on update to check the roles of the user and the state being set and abort the update with a message. 

Those are the options I've had the most success with. 

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

 

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Hi Michael,

I need to restrict the STATE Field value ‘Closed’ should be visible only for Admin user.

 

Please provide the septs.

 

Regards,

Tharun k

Hi,

You can use onCell Edit and check if the value is closed and if user is not admin then stop the saving

Regards
Ankur

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

@Tharun 

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