- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2021 02:28 AM
Hi All,
I have a requirement to change the label of a variable in a catalog item, tried using 'setLabelOf' but its not working as its not supported for catalog forms and i cannot change the label directly because this variable is part of variable set which is being used by multiple other forms.
Can anyone suggest for any alternative. below are the requirement.
Existing label - Do you need a official service along with request.
New label - Do you need data service along with the request
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2021 03:46 AM
Here you go to make it work for both native + portal
onLoad Catalog Client Script on Your Catalog Item
UI Type - ALL
Isolate Script - False
a) This field is not on form but from list you can make it false
Script:
function onLoad(){
setTimeout(function(){
var newLabel = 'My Label';
var oldLabel = 'My New Label';
if(window != null){
$j("span").filter(function() {
return ($j(this).text() === oldLabel);
}).html(newLabel);
}
else{
var aTags = this.document.getElementsByClassName("ng-binding");
var found;
for (var i = 0; i < aTags.length; i++) {
if (aTags[i].textContent.toString() == oldLabel) {
aTags[i].innerHTML = newLabel;
break;
}
}
}
}, 3000);
}
Output:
Portal:
Native:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2023 05:39 AM
need help