Catalog Item Variables readonly_clickthrough=true attribute?

Chase Stevenson
Mega Guru

Hello, I'm aware that you can set a dictionary attribute on reference table columns so you can click to the referenced record even if the field is read only: readonly_clickthrough=true.

Is there a similar way to do this for catalog item variables?

We have catalog items where the variables are all set to read only on the SCTASK record. The issue with this is you can't click through the read only to view the referenced record like you normally could on any other field on other tables because this is a catalog item variable. Here's an example of a catalog item variable that is a reference with no click through functionality:
find_real_file.png

Here is an example of a reference field on a table with click through functionality:
find_real_file.png

Is this even possible for catalog item variables? I tried to write that attribute readonly_clickthrough=true in the reference variable attributes but it didn't do anything.

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

Unfortunately, for catalog variables, that attribute doesn't seem to work.

You'd have to enable the system property: glide.ui.reference.readonly.clickthrough

However, as you know, it does it for all read-only reference fields. Then, going forward, for fields that are read-only where you don't want the reference icon to show, you'd have to use: readonly_clickthrough=false

Here's a variable, read-only, with click through showing it working:

find_real_file.png

But again...on variables, that attribute (now: readonly_clickthrough=false) doesn't seem to work...heh...

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Kieran Anson
Kilo Patron

Not to say this is the recommended way as DOM manipulation is strongly discouraged but the following will undo the disablement for the clickthrough icon if you're stuck between a rock and hard place with enabling the system property as suggested by Allen.

 

g_form.setVariablesReadOnly(true);

		var variables = g_form.elements.filter(function(el){
			return el.tableName == 'variable' && el.type == "reference";
		});

		variables.forEach(function(el){
			try{
			var control = g_form.getControl(el.fieldName);
			var id = control.id;
			var d = document.getElementsByName(id + ".ui_policy_sensitive");
			d[0].style.display = "";
			}catch(e){
				g_form.addErrorMessage("Failed to apply Reference Variable Removal");
				console.log(e);
			}
		});

The try/catch adds a bit of safety and will present an error if an issue does occur down the line as part of platform changes.

 

Again, if I could add a big red siren to say DOM manipulation is strongly discourage by ServiceNow I would. This is more for informational purposes and a last resort.