How can I format a UI Macro to add icon next to URL field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 06:59 PM
I'd like to be able to display icons for various social media sites next to URL fields on a form (bonus if the icon works like a button to open a new browser tab). I've worked with UI Macros to display buttons next to reference fields, but so far I haven't had any luck doing the same with URL fields, and honestly not sure it's possible the same way.
Things like call me or MS Teams buttons have been easy enough to set up (excuse the button formatting, just threw together to test).
Has anyone done something similar for non-reference fields and can provide some advice on the correct way to implement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 01:15 PM
KB0781649
field_decorations and ref_contributions attribute does not work for URL field
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0781649
Probably could do something with a client script and DOM manipulation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 01:41 PM
Yep add an onLoad client script to append a new element after the URL Field's Unlock button.
var span = document.createElement('span');
span.innerHTML='<span class="btn btn-default icon-mail" onclick="doSomething();" title="Do Something"></span>';
document.querySelector("#yourtablename\\.yourfieldname-addons").append(span);