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 to add color to "Check Box Text" in service catalog???

Mr_m1
Tera Expert

How to add color to Check Box "Text" -> Adobe Acrobat in service catalog

 

As im not having Macros

Any ideas

Thanks

Mounish

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Mounish 

this worked for me in Native + Portal

Remember this uses DOM which is not recommended.

Ensure Isolate Script = False for this

Client Script: Isolate Script False

function onLoad(){

	setTimeout(function(){ 
		if(window != null){
			// native
			var z = document.getElementsByClassName("checkbox-label");
			for (k = 0; k < z.length; k++) {
				if(z[k].innerHTML == 'Adobe Acrobat'){
					z[k].style.color = 'red';
				}
			} 
		}
		else{
			// portal
			var aTags = this.document.getElementsByClassName("ng-binding");
			var searchText = "Adobe Acrobat";
			for (var i = 0; i < aTags.length; i++) {
				if (aTags[i].textContent.toString() == searchText) {
					aTags[i].style.color = 'red';
					break;
				}
			}
		}
	}, 3000);
}

find_real_file.png

find_real_file.png

Output: Native

find_real_file.png

Output: Portal

find_real_file.png

Please mark my response as correct and helpful to close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

19 REPLIES 19

shloke04
Kilo Patron

Hi,

Please follow the solutions provided in below thread on the same query:

https://community.servicenow.com/community?id=community_question&sys_id=7b7cb697dba71b00200f0b55ca9619e0

https://servicenowguru.com/system-ui/field-styles-service-catalog-variables/

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Thanks Shloke 

Its worked as expected

 

Thanks

Mounish

But it shows as javascript error in SP

Mark "Isolate script" field to "false"