Generate link in client script gs.showFieldMsg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2011 05:44 AM
We can use a gs.showFieldMsg to display text near a field. What if we want to make part of that text a link?
function onChange(control, oldValue, newValue, isLoading, isTemplate) { //If the page isn't loading if (!isLoading) { //If the new value isn't blank if(newValue != '') { //Type appropriate comment here, and begin script below var bs = new GlideRecord("cmdb_ci_service"); if(bs.get( newValue ) ){ var dept = new GlideRecord('cmn_department'); if( dept.get( bs.u_service_provider ) ){ var info = 'Service Provider: <a href="nav_to.do?uri=cmn_department.do?sys_id="'+dept.sys_id+'>'+dept.name+'</a>\n Service Category: '+bs.u_service_category; g_form.showFieldMsg('u_business_service', info, 'info'); } } } } }
Problem is this field message shows the
"<a href="portion as well instead of displaying it as HTML. Is there a way to can generate a link to a record in a showFieldMessage?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2017 08:16 AM
Akeel, How are you embedding the link in 'Portal'. Can you give the steps or syntax?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 12:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 08:05 AM
Hi Ramya,
Use hide field Message :
g_form.hideFieldMsg('variablename',true);
Like
g_form.hideFieldMsg('u_desktop', true);
Example
onChange:
var test=g_form.getValue('u_desktop');
if ( test == 'yes')
{
g_form.hideFieldMsg('u_desktop', true);
g_form.showFieldMsg('u_desktop','Please refer to the Reference Guide for Knowledge base Article Editors for instructions and tips to create End-User articles','info');
return false;
}
It wont repeat again..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2019 06:15 AM
I have face it the same situation, I just create a variable macro+widget with the text and the hyperlink, and then a UI policy that will condition that macro variable to be displayed only if in the field X = value Y.
Also some CSS to align that hyperlink.
Thanks,
Adrian