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 highlight catalog item variable using client script.

praveen1231
Tera Contributor

Hi all,

I had created a catalog item variable called Album(check box). Need to highlight it in bold and any color using client script. Plz help me to solve it. Thank you

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage

@praveen1231 

 

I have tried in my PDI, please write a onLoad client script and mention below script there:

setTimeout is added just to load the form completely

function onLoad() {
setTimeout(function() {
if (window != null) {
// native
g_form.getControl('PLEASE_PROVIDE_LABEL_OF_YOUR_FIELD').setAttribute('style', 'font-weight: bold;color:blue');
} else {
// portal
var aTags = this.document.getElementsByClassName("ng-binding");
var searchText = "PLEASE_PROVIDE_LABEL_OF_YOUR_FIELD";
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent.toString() == searchText) {
aTags[i].style.fontWeight = 'bold';
aTags[i].style.fontSize = 'x-large';
//alert(aTags[i].style.width);
break;
}
}
}
}, 3000);
}

 Please Accept the answer or mark it helpful if it works!

View solution in original post

1 REPLY 1

Prince Arora
Tera Sage

@praveen1231 

 

I have tried in my PDI, please write a onLoad client script and mention below script there:

setTimeout is added just to load the form completely

function onLoad() {
setTimeout(function() {
if (window != null) {
// native
g_form.getControl('PLEASE_PROVIDE_LABEL_OF_YOUR_FIELD').setAttribute('style', 'font-weight: bold;color:blue');
} else {
// portal
var aTags = this.document.getElementsByClassName("ng-binding");
var searchText = "PLEASE_PROVIDE_LABEL_OF_YOUR_FIELD";
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent.toString() == searchText) {
aTags[i].style.fontWeight = 'bold';
aTags[i].style.fontSize = 'x-large';
//alert(aTags[i].style.width);
break;
}
}
}
}, 3000);
}

 Please Accept the answer or mark it helpful if it works!