How to add the hyperlink in the portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @PRAGHATIESH S ,
Could you please have a look at the sample script below and let me know if it is useful
function onLoad() {
var ga = new GlideAjax('GetPurchaseRequestDetails');
ga.addParam('sysparm_name', 'getPurchaseRequest');
ga.addParam('sysparm_external', g_form.getUniqueValue());
ga.getXMLAnswer(function(response) {
var res = JSON.parse(response);
if (res.conditionMet == true || res.conditionMet == "true") {
var contactLink = res.contactLink;
// Create a clickable hyperlink
var fieldMsg = "The total amount of your request exceeds €250k, therefore your request must be handled in the S2C process.<br>";
fieldMsg += '<a href="' + contactLink + '" target="_blank">Contact Person</a>';
g_form.showFieldMsg('u_total_of_esr_request_eur_incl_changes', fieldMsg, 'info');
} else {
g_form.hideFieldMsg('u_total_of_esr_request_eur_incl_changes', true);
}
});
}
Thanks
Santosh.P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
You will have to create a hyper link in a tag like below:
“<a href=“ +contactlink +”>Link<a>”
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
showFieldMsg() doesn't support HTML tags and hence you cannot show link there using that function.
Workaround
1) create Rich Text Label variable and store the static link there and always hide this variable using UI policy
2) then from your client script show/hide this above variable and show link
OR
1) If your link is dynamic then create a widget and add it to variable of type Custom
2) then in that widget observe the change of variable and do GlideAjax there and show the link in the widget HTML section
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Thank you for marking my response as helpful.
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