How to change the label of a column in the "Data Table from Instance Definition" widget on the Service Portal

Surendra Poosa1
Kilo Expert

Hello,

I have a  "Data Table from Instance Definition"  widget on the service portal. I am using the table alm_hardware and selected a few columns to display.

Is it possible to change the label for a column on one widget. We want to change the label on the Widget not on the table definition.

Thank You

Surendra 

1 REPLY 1

Cuong Phan
Kilo Sage

Hi Spark106,

 

You can simply do that by following below steps.

Step1. Find the label HTML

find_real_file.png

Step2. In your widget client script, catch and change it.

// Change Field label
// Timeout for data to be loaded
	setTimeout(function(){
		document.querySelector('div[aria-label="Sort by  Short description"]').innerText = "Long Description"
	},3000);

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

 

Cuong Phan

DXC Consultant.

Regards,
Cuong Phan
ServiceNow Technical Lead