Notifications

2074 views

Description

Navigating to a KnowledgeBase article on the Service Portal does not show images embedded in the KB article.

A user either does not see an image at all, or sees a broken icon:

For the issue to be seen, two scenarios are required:

  • The images were added to the KB article by uploading images from the user's computer, so the anchor tag for the source of the HTML contains a reference to the sys_attachment table:

src="sys_attachment.do...

  • The URL contains an extra slash after the Portal ID and before the question mark. For example, this URL may see the issue:

https://<instance>.service-now.com/sp/?id=kb_article&sys_id=<sys_id>

Note that a user may not be navigating directly to the Service Portal to cause the issue, but may be redirected using the glide.entry.first.page.script property with the Script Include SPEntryPage.

 

Steps to Reproduce

 

  1. Create a KnowledgeBase article.
  2. Add an image to the article using type Attachment and upload an image from the local machine
  3. Inspect the Source Code for this HTML article - note how the anchor tag contains a reference to the sys_attachment table:
    • <img src="sys_attachment.do...
  4. Insert another image, but this time, type Image Library. Note how the anchor tag is a direct reference to the image:
    • <img src="file.png"
  5. Load the KB article on the Service Portal. Ensure there is NO forward slash character between the Service Portal ID sp and the question mark ?.
    • https://<instance>.service-now.com/sp?id=kb_article&sys_id=<sys_id>
  6. Note how both images are rendered correctly.
  7. Add a forward slash between the Service Portal ID and the question mark:
    • https://<instance>.service-now.com/sp/?id=kb_article&sys_id=<sys_id>
  8. The first image will now NOT be seen, showing either no image or a broken image icon. The hyperlink to the image (as shown in the browser developer console) will be similar to the following:
    • https://<instance>.service-now.com/sp/sys_attachment.do?sys_id=<sys_id>

The URL is incorrect as the reference to the sys_attachment record should not reference the Service Portal ID /sp.

The platform is unable to process the hyperlink to the attached image due to the extra forward slash in the URL. The image attached from the Image Library is rendered correctly. 

Note: the Source Code for an HTML element can be viewed using the following icon on the HTML editor toolbar:

Icon on the HTML editor toolbar: < >

 

Workaround

To workaround the issue, consider the following:

  • Ensure any defined hyperlinks on the Service Portal are not directing the users to a URL with the forward slash before the first question mark. The forward slash is not added by default to hyperlinks within the Service Portal.
  • If the user is being redirected to the Service Portal on login, then the Script Include SPEntryPage may be in use. This Script include redirects the URL to the Service Portal, but may include a forward slash after the Portal ID. This forward slash is hard coded in the Script Include, but can be configured to remove it: Configure the Service Portal login page
  • Rather than attaching images to KB articles using file attachments, consider storing the images to the instance. Attached files of type Image Library do not have this issue.
  • If the issue only affects a small number of images, the source HTML can be updated directly. Edit the article, then select Source Code in the HTML editor. Locate the image references and update any URLs to include a forward slash before the reference to sys_attachments:

<img src="/sys_attachment.do...


Related Problem: PRB1102179

Seen In

Helsinki Patch 9a

Fixed In

Kingston

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-12-18 16:17:28
Published:2017-10-23