how to pass string filed value into HTML filed which show as HTML value only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 08:41 AM
Hi All,
I am getting value through script include from backed the filed type is string and placing that value in HTML filed but the value coming in this HTML filed as string value But I want that value as HTML how I can do that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 02:52 AM
Hi @keshav77
Please add below code in client script
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('GetHTMLData');
ga.addParam('sysparm_name', 'getLink');
ga.getXMLAnswer(updateLink);
}
function updateLink(answer) {
var s = '<p><a href=' + answer + ' target="_blank">sejal</a></p>';
g_form.setValue('u_html', s);
}
Script include
var GetHTMLData = Class.create();
GetHTMLData.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getLink: function() {
return 'https://google.com';
},
type: 'GetHTMLData'
});
OUTPUT
Please Mark Helpful and Correct if it really helps you.
Regards,
Sejal Chavan
Thanks & Regards
Sejal Chavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 03:03 AM
if value you are getting from script include is string then it will only set string.
did you try to append the HTML tags?
please share what value you are getting and what should be set in target field?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader