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.

How make record producer variable editor fields READONLY?

sinu2
Tera Expert

Hi All,

 

I have a record producer once submit the record producer i have to make READ ONLY all fields in the variable editor. Please find below screen shot.

 I have used the below method to make read only but no luck it is not working.

 

g_form.setVariablesReadOnly(true);

find_real_file.png

7 REPLIES 7

Mark Roethof
Tera Patron
Tera Patron

Hi there,

We are using a onLoad Client Script (on task table) for this. Maybe that's what you are after?

function onLoad() {

	//Type appropriate comment here, and begin script below
	try{
		//Get the 'Variables' section
		var ve = $('variable_map').up('table');
		//Disable all elements within with a class of 'cat_item_option'
		ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
			elmt.disabled = true;
		});
		//Remove any reference or calendar icons
		ve.select('img[src*=reference_list.gifx]', 'img[src*=small_calendar.gifx]').each(function(img){
			img.hide();
		});
		//Hide list collector icons
		ve.select('img[src*=arrow]').each(function(img){
			img.up('table').hide();
		});
	}
	catch(e){}

}

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Hello Mark,

 

I've tried to implement above suggestion,  but was still unable to make variables read only on the custom table I created.  Please suggest me If I'm missing anything else.

Konstantin7
Mega Guru

Create a Catalog UI Policy from within the Record Producer. If you want the UI Policy to be in effect after a record has been created, make sure to check the Target Record checkbox. And Uncheck 'Applies on a Catalog Item view'.

Yup, this is exactly how you do it.  Thanks a lot, super helpful!