Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Hiding Labels by a UI Policy

dmullinax
Mega Guru

We have in a variable set a variable of type "formatter."
find_real_file.png

We have several other departments that use this application, but this one department in particular wants to hide this option.
find_real_file.png

Note our business owner wanted the first one hidden as well, but this one was generated automatically by the system.
"When there are 2 or more checkboxes on a Catalog Item / Order Guide, a label named "Options" appears on top of the checkboxes."  https://hi.service-now.com/kb_view.do?sysparm_article=KB0679539

I would like to hide this one as well, but going back to the second one it is defined in the variable set.

Anyways, I try to hide this in a UI Policy.  When I try to define this in a UI Policy action, the variable name does not show up in the "Variable name" drop-down.  As you can see, there is no "formatter" or the name I gave it from the first screen shot.
find_real_file.png

How do I hide these labels?

1 ACCEPTED SOLUTION

dmullinax
Mega Guru

I finally found a solution, and leaving this here for the next developer who needs it.

In the Catalog UI Policy.  In the script tab, use this code...

var doc = this.document ? this.document : document;
var x = doc.getElementsByTagName("label");

for(var i = 0; i < x.length; i++){
    if(x[i].textContent == "Options"){
    x[i].style.display = "none";
    }
}

I even found ways to format the margins, set text color, etc. using JavaScript.

View solution in original post

5 REPLIES 5

dmullinax
Mega Guru

I finally found a solution, and leaving this here for the next developer who needs it.

In the Catalog UI Policy.  In the script tab, use this code...

var doc = this.document ? this.document : document;
var x = doc.getElementsByTagName("label");

for(var i = 0; i < x.length; i++){
    if(x[i].textContent == "Options"){
    x[i].style.display = "none";
    }
}

I even found ways to format the margins, set text color, etc. using JavaScript.