Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hyperlink in HTML Field and open in new tab

sondrefaane
Tera Contributor

I have an HTML field in ServiceNow where users can toggle editability using a checkbox. Here's how it's configured:

  • UI Policy:

    • Name: Make HTML/Link field editable

    • Condition: When the checkbox is checked

    • Action: Sets the HTML field's Read-Only property to false, allowing users to paste links.

  • Business Rule:

    • Name: Edit HTML Field false

    • When to Run: Before Insert/Update (both set to true)

    • Action: After saving, it sets the field back to Read-Only (unchecked) and ensures the links cannot be edited unless toggled again.

Problem:
When users paste links into the HTML field, the links open inside the tiny HTML field rather than in a new browser tab. I know I can manually click the link icon and change "open link in..." to "New Window (_blank). However, the end users want the process to be seamless. They don’t want to manually modify the HTML—they just want to:

  1. Click Allow Edit (checkbox on)

  2. Paste links

  3. Click Allow Edit (checkbox off)

  4. Click the links later, and have them open in a new tab by default.

Question:
Is there a way to automatically modify the links in the HTML field to include target="_blank" when the field is set back to read-only (i.e., after the checkbox is unchecked)?

Alternatively, can I globally configure the HTML field to treat all links as opening in a new tab without manually adding target="_blank" for each link?

3 REPLIES 3

Vishwa Pandya19
Mega Sage

Hello,

 

You can set the property glide.ui.html.editor.default_link_target to _blank so that all links throughout the instance will open on a new tab.

 

If my answer has helped you in any way please mark it as correct or helpful.

Ankur Bawiskar
Tera Patron
Tera Patron

@sondrefaane 

this property can be updated glide.ui.html.editor.default_link_target to _blank

But remember it would be a global change in entire instance which I won't recommend.

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

What if I don't want to press the link button, and just paste? I tried changing this, but it doesn't apply to the links i directly paste as free-text. They still use implicit.