To Create hyperlink in Client scripts, showFieldMsg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 04:31 AM
Hi All,
I'm trying to create a link in onChange Client script. Any Help will be Appreciated.
This is the actual link : https://instance_name.service-now.com/ess/form.do?sysparm_document_key=sc_cat_item,6b25d2b90c9a3d008...
And Trying the below Script, but getting the error saying "JavaScript parse error at line (7) column (159) problem = missing ; before statement"
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var url = '<a href="instance_name.service-now.com/ess/form.do?sysparm_document_key=sc_cat_item,6b25d2b90c9a3d008febd07b4e7cce07" target="_blank">'+click here+'</a>';
var access = g_form.getValue('access_level');
if(access != 'E1 License' || access != 'E3 License'){
g_form.showFieldMsg('access_level',url,'error');
}
else {
g_form.hideFieldMsg('access_level', true);
}
}
Thanks,
Sowmya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 05:24 AM
var url = '<a href="instance_name.service-now.com/ess/form.do?sysparm_document_key=sc_cat_item,6b25d2b90c9a3d008febd07b4e7cce07" target="_blank">'+click here+'</a>';
So, you have a '+ click me +'.. not sure what you are trying to do here. Give the name of the Link? That is a variable call, with the pluses. I would try this:
var url = '<a href="instance_name.service-now.com/ess/form.do?sysparm_document_key=sc_cat_item,6b25d2b90c9a3d008febd07b4e7cce07" target="_blank">Click here</a>';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2015 05:53 AM
Apparently, hyperlinks are not supported. You should chec out Mark's suggestion here: Generate link in client script gs.showFieldMsg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2018 05:23 PM
You need to get a little creative to make it work.
1. On the platform UI UI macro works.. so use that to show the html text
2. On the service portal macros wont render but instructions field on the catalog variable will work so use that.
Basically a variable of type - Macro with Label which has the macro and instructions on it will work perfectly in both platform UI and service portal.
screenshot for service portal
screenshot from platform UI
Variable screenshots
macro screenshot