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

Any assistance would be much appreciated!!
 @Ankur Bawiskar 

@dmahendran 

If your agent wants to see other field value from the referenced table then why not bring that field on form as dot walked and make it readonly.

your purpose is solved.

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

It’s not about adding a field it’s about renaming an existing form section  based on the Service Line selected above. The form section itself already contains certain fields, so I can’t simply make it a new field. Essentially, it’s a user experience enhancement where we highlight this section and add additional fields to it depending on the selected Service Line.


dmahendran_0-1754894561878.png

 

@dmahendran 

So dynamically you want to add some field in that form section? If yes then that's not possible.

Form Section needs to have that field and based on your condition, you can show/hide it.

You want name of form section to be changed using DOM?

If yes then I won't recommend this

But this worked for me, Ensure Isolate Script=False for your client script for DOM to run

$j('span.tab_caption_text').each(function() {
    var currentText = $j(this).text().trim();
    
    if (currentText === 'Cause') {
        $j(this).text('New Cause');
    }
});

Output:

change form section name DOM.gif

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