How to pass URLs in catalog OnLoad script in showFieldMsg
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 10:18 PM
hi Developers,
I want to pass the URL links from backend table to the catalog form in showFieldMsg.
I am able to get it in array till script include, but unable to show it in catalog script.
Kindly help me with the script, also the links should be in clickable format in new tab.
Script include :
var LinksDisplay = Class.create();
LinksDisplay.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getdisplayLinkName : function() {
var arr = [];
var grurl = new GlideRecord('u_links');
grurl.addEncodedQuery("u_link_urlISNOTEMPTY");
grurl.query();
while (grurl.next()){
arr.push(grurl.getValue("u_link_url"));
}
for(var i=0 ;i<arr.length;i++){
gs.log('Test'+ arr[i]);
}
return arr[i];
},
type: 'LinksDisplay'
});
Client script :
function onLoad() {
//Type appropriate comment here, and begin script below
var getData = new GlideAjax('LinksDisplay');
getData.addParam('sysparm_name', 'getdisplayLinkName');
getData.getXML(helloLinkParse);
}
function helloLinkParse(response){
var answer = response;
alert(response);
var tlist = answer.split(",");
g_form.showFieldMsg('u_links', 'Find the links :' + tlist);
}
Thanks in advance,
Shwetha
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2024 12:02 AM
@Shwetha Nair without the toString() the response will not be returned to client side, it will always return null.
Once you get the response you can manipulate the links on client side
