Dom Manipulation issue

dmahendran
Tera Contributor

Hello folks.
                      I’m facing an issue with DOM manipulation. The requirement is: based on the value selected in the Service field, I need to populate the related Name in a specific tab of the Case record. This tab should display the name that is linked to the selected service. I tried using a GlideAjax call within an onChange client script, but it’s not working. The goal is to have the name in that tab automatically populated according to the selected service.

13 REPLIES 13

Attaching the snips here.. Here the tab only shows the name as case, instead of related name of the service line tab.

dmahendran_0-1754889536660.png

 

dmahendran_1-1754889684265.png

Any other suggestions @Ankur Bawiskar 

@dmahendran 

based on field change what you want to do?

why DOM is required?

If you are trying to change the display value of reference field on the fly using DOM then it's not recommended and may not work.

That's not how Reference field works.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Based on the value selected in the Service Line reference field, I need to display a related list tab that corresponds to that specific Service Line. I tried using DOM manipulation to capture the Service Line and update the tab with the corresponding field name, but I couldn’t get it to work it always defaults to showing Case.

@dmahendran 

Based on field change you need to display a related list tab OR form section?

From your image it looks like a form Section for Case, so you can use this syntax to show/hide the form section

g_form.setSectionDisplay('case', true);

The section name is the lowercase text for the text.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hiding and showing the section works fine, but dynamically changing its name is the issue. Instead of displaying the updated name, it keeps showing the default Case in the section, which is causing the problem.