Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need to write an ACL to allow only members of particular group to edit few fields in location table

Kayathri
Tera Contributor

Hi Team,

 

Having a requirement to write a ACL to allow only members of a particular group to edit three user defined fields in location table. Kindly suggest.

 

Regards,

Kayathri

1 ACCEPTED SOLUTION

Hi,

so members of that group should be allowed editing only 3 fields

All others should be readonly

Do this

Display BR on your table:

g_scratchpad.isMember = gs.getUser().isMemberOf('Group Name');

onLoad Client Script:

function onLoad(){

	if(g_scratchpad.isMember.toString() == 'true'){

		// make all fields readonly
		var fields = g_form.getEditableFields();
		for (var x = 0; x < fields.length; x++) {
			g_form.setReadOnly(fields[x], true);
		}

		// make those 3 fields as editable
		g_form.setReadOnly('fieldA', false);
		g_form.setReadOnly('fieldB', false);
		g_form.setReadOnly('fieldC', false);
	}

}

Regards
Ankur

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

View solution in original post

11 REPLIES 11

Glad to help.

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

@Kayathri 

Would you mind closing this question by marking appropriate response as correct

How to translate, None in Arabic, where None is OOTB

Regards
Ankur

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