How to change Label (Display Label) dynamically for related lists

narayanan2
Giga Contributor

How to change Label value (Display Label) dynamically for related lists tables based on some conditions.

e.g.,

CI Class: cmdb_ci_storage_server

Related List: cmdb_ci_storage_controllers

Condition: If cmdb_ci_storage_server.manufacturer = EMC i'd like to set/change the 'Label' for cmdb_ci_storage_controllers

3 REPLIES 3

souren0071
Tera Expert

Hi,



If I am not wrong, you want to change the label of a releated list based on the value of field in the form.



I dont think there is a way to change the related list label. You can create another related list from relationship and add it into the form. Create a onload client script and based on the field value you can show or hide your desired related list.



9.7 hideRelatedList

void hideRelatedList(listTableName)


Hides the specified related list on the form.
Parameters:
listTableName - specifies the name of the related list. Use the list sys_id to hide a list through a relationship.
Returns:
void

9.15 showRelatedList

void showRelatedList(listTableName)


Displays the specified related list on the form.
Parameters:
listTableName - specifies the name of the related list.
Returns:
void
Please mark helpful/correct/like based on impact.
Regards,
Souren

Thanks for the quick reply! However, even with the new related list I can probably filter the results but don't see an option to change the label. And I believe the Label of the related list to linked to the Table definition.



Please correct me if I am wrong?


Did you got a chance to go through the below threads, these might be helpful for your query:



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


Dynamic Field Labels — ServiceNow Elite



Regards,


Shloke


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

Regards,
Shloke