Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

I want to change the field labels for related lists on a per-table basis.

bonsai
Mega Sage

I want to change the custom field labels on a per-table basis.
I thought this could be achieved by simply adjusting the labels.

However, the field labels displayed in the related list did not change.
The related list is implemented using relationship records.
Is there a good way to handle this?

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@bonsai 

if you change field label and that field is part of related list, it will show the new label

on form you can write client script to change label using g_form.setLabelOf('fieldName', 'New Label');

But nothing as such is available on list

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@bonsai 

Thank you for marking my response as helpful.

If you're still facing any issues, I'd be happy to help further.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Tanushree Maiti
Tera Patron

Hi @bonsai 

 

Check Similar post:

How to change Label (Display Label) dynamically for related lists  (though its old)

https://servicenowguru.com/ui-scripts-system-ui/modifying-label-form-fields-client-scripts/

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Chaitanya ILCR
Giga Patron

Hi @bonsai ,
to change the label in the related list
example
if you want to change the SLA definition label to "OLA Definition" on the incident table 

ChaitanyaILCR_0-1785400016537.png

create an onLoad client script like this 

in this case since the the related list is on the incident table I have created the client script on the incident table

you can create the client script on your desired table

 

Note:Isolate script should be = False and

the user preference should be with the form for this to work

ChaitanyaILCR_2-1785401817169.png

 

script 

the fieldName is the name of the column(backend name) on the related list

and the tableOfTheField is the related list table name

function onLoad() {
   var fieldName = 'sla' // add you table here
	var tableOfTheFiled = 'task_sla' // related list table name
    var th = document.querySelector(`th[glide_field="${tableOfTheFiled}.${fieldName}"]`);
    if (th) {
        var link = th.querySelector('a.column_head');
        if (link) {
            link.textContent = "OLA Definition"; // add you new label here
        }
    }
}

 

ChaitanyaILCR_1-1785401625795.png

 

result

ChaitanyaILCR_3-1785401937807.png

and this only works in the native UI not on the workspace

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya