Images are not displaying in the portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2022 03:46 AM
Hello Experts,
We have to display the images of incident and RITM on the homepage of the portal. And used the below script to display the images. It is not working
if (gr.sys_class_name.toString() == "sc_req_item") {
f.aClass=gr.sys_class_name.toString();
if($sp.getCatalogItem(gr.getValue(name)).icon != undefined)
{
f.image = $sp.getCatalogItem(gr.getValue(name)).picture;
f.image = "incident.png";
}
var ge = gr.getElement(name);
if (ge) {
var ed = ge.getED();
if (ed)
f.type = ed.getInternalType();
f.label = ge.getLabel();
}
return f;
}
function getImageForCatalogItem(gr, name) {
var grImage = new GlideRecord("sys_attachment")
grImage.addQuery(table_sys_id, "f7b6b5b2dbd3b7003fefd7b7f4961970");
if (grImage.image != undefined)
f.image = grImage.image + "";
}
Recently studied one article saying that getCatalogItem method is deprecated. That's the reason it is not displaying the images. Please find the below information.
getCatalogItem(String sysId)
This method is deprecated. Use the getCatalogItem(String sysId, Boolean isOrdering) method instead. This method calls the getCatalogItem(String sysId, Boolean isOrdering) method with the isOrdering parameter set to false, which means that write roles security checking is done.
Could you please help me how to display the image in the portal which is not a static image.
Thanks alot in advance.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2022 07:37 AM
Hi Sudha,
Can you try the following function using the sys_id of the catalog item
var catalogItemJS = new sn_sc.CatItem(SYS_ID OF CATALOG ITEM);
var catItemDetails = catalogItemJS.getItemSummary();
f.image = catItemDetails.picture;
Hope this helps,
Shane