We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

FSM My Tasks List

tomaslindev
Mega Guru

Hello everyone,

 

I'm modifying the views in the FSM portal. I need to change the name "Company" to "Client" and a couple of other names. The issue is that they want the label changes to only affect the fsmcp and fsmcp_agent views, not the entire table. I've tried a UI Policy and a Client Script that affect the records but not the column names in the list. Any ideas?

 

Thanks a lot and best regards.

 

 

Example 2.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@tomaslindev 

your requirement is not feasible to implement.

💡 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

View solution in original post

7 REPLIES 7

Hello @Dr Atul G- LNG  and @Ankur Bawiskar ,
I've managed to make the change, I added a widget right below the widget to be modified, and within the Client controller section, I added the changes, forcing the new widget to rewrite the column labels.

api.controller = function() {

    (function waitForTitles(maxAttempts) {

        // Headers por aria-label (según idioma)
        var companyEn = document.querySelector('.th-title[aria-label="Company"]');
        var companyEs = document.querySelector('.th-title[aria-label="Empresa"]');

        var numberEn = document.querySelector('.th-title[aria-label="Number"]');
        var numberEs = document.querySelector('.th-title[aria-label="Número"]');

        var titlesUpdated = false;
        var cellsUpdated = false;

        // Company/Empresa
        if (companyEn) {
            companyEn.textContent = 'Client';
            titlesUpdated = true;
        }
        if (companyEs) {
            companyEs.textContent = 'Cliente';
            titlesUpdated = true;
        }

        // Number/Número
        if (numberEn) {
            numberEn.textContent = 'Work Order';
            titlesUpdated = true;
        }
        if (numberEs) {
            numberEs.textContent = 'Orden de trabajo';
            titlesUpdated = true;
        }

        // Change "Field Performance" to "Failure" in cells
        var cells = document.querySelectorAll('[role="cell"].sp-list-cell');
        cells.forEach(function(cell) {
            if (cell.textContent.trim() === 'Actuación de campo') {
                cell.textContent = 'Avería';
                cellsUpdated = true;
            }
        });

        // If titles and at least one cell change have already been applied, stop 
       if (titlesUpdated && cellsUpdated) return;

        if (maxAttempts <= 0) return;

        setTimeout(function() {
            waitForTitles(maxAttempts - 1);
        }, 50);

    })(200);

};

 

@tomaslindev 

So basically you are playing with the DOM manipulation to change the label?

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

Yes @Ankur Bawiskar , I only wanted to change the label in the FSM portal in the list associated with the user without changing the internal value of the fields.