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.

Hiding reference (Magnifying glass) on Service Catalog for all fields or single field.

nmartinez
Kilo Contributor

I am trying to figure out a way to hide the reference magnifying glass icon on the Service Catalog. I know how to use jquery or getElelmentByID; and it works on the incident form and other forms; but it the same code will not work on the Catalog.

This is just one example I am using that works everywhere else except the catalog.

disableMagnifyingGlass1 = document.getElementById('lookup.ReferenceFieldName');
disableMagnifyingGlass1.style.display = 'none';

Any ideas?

4 REPLIES 4

ravali6
Giga Contributor

You can make the reference look up non clickable:

See this link:

http://wiki.servicenow.com/index.php?title=Customizing_the_Reference_Icon

Ravali


justin_drysdale
Mega Guru

Here is the html for the reference field magnifying glass in our instance (Aspen):



<a id="lookup.IO:cc41d69f2b600100200ff79069da1545" onclick="mousePositionSave(event);reflistOpen( 'IO:cc41d69f2b600100200ff79069da1545', 'not', gel('IO:cc41d69f2b600100200ff79069da1545TABLE').value, '', 'false', 'true')" style="padding-right:4px;" tabindex="1"><img width="18" height="16" border="0" src="images/reference_list.gifx" title="Lookup using list"></img></a>


Your element ID will probably be different, just check the page source.


Yes, thank you. I've tried the ID 'IO:SYSID' too. It also works on forms, just not Service Catalog.

It's as if the catalog ignores jquery all together for those items.


russell_miller
Kilo Guru

Hi,



Put this together to solve this one...



function lookupHider(theField){


  //Sets the placeholder for a reference field


  var nameID = g_form.getControl(theField).id;


  var theSelector = "a[id*=" + '"lookup.' + nameID + '"]';


  var d = document.querySelector(theSelector);


  d.style.display = "none";


}



Just use this function in your client script like this:



lookupHider('u_requestor');