
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 06:15 AM
I got a request to see about changing the knowledge article view at the bottom from this:
to something closer to this:
You can see this information from the All Articles View, but it would also greatly help if we could see it from the article itself.
I've dug into the properties (Configuring Knowledge Properties - ServiceNow Wiki ) and haven't found anything related to this functionality.
I've done some research on updating the kb_view.do page, since I believe that's what I need to do to accomplish this.
https://community.servicenow.com/thread/161516?q=Can%20you%20update%20the%20kb_view.do
Re: I am trying to add additional fields when you view a knowledge article from within an Incident.
I'm under the assumption modifying these pages is discouraged because of updates and things of that sort.
Any advice or ideas on how I could solve this problem? Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Knowledge Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 07:52 AM
Here is an un-styled implementation of the footer you've been asked to create:
"kb_view_common_footer" UI Macro.
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:inline template="kb_view_common_footer_metadata_attachments" />
<g:inline template="kb_attached_tasks_v3"/>
<g:inline template="kb_affected_products_v3"/>
<!--OOB Code - Start-->
<!--
<div class="snc-article-header-author">
<j:choose>
<j:when test="${authorImage.length != 0}">
<img id="authorImage" class="snc-article-header-author-image" src="${authorImage}" />
</j:when>
<j:otherwise>
<div id="authorGhost" class="icon-user-profile snc-article-header-author-ghost" />
</j:otherwise>
</j:choose>
<div id="articleAuthor" class="snc-article-footer-metadata-published" style="display: block;padding-top: 5px">
${gs.getMessage('Authored by {0}', authorName)}
</div>
<g:evaluate var="jvar_time_ago_msg">
var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on");
gs.getMessage("Last modified {0}", timeAgo);
</g:evaluate>
<div id="articleModified" class="snc-article-footer-metadata-published">
${jvar_time_ago_msg}
</div>
</div>
-->
<!--OOB Code - End-->
<!--Custom Code - Start-->
<div class="snc-article-header-author">
<div class="kb_version">${gs.getMessage('Version')}: ${knowledgeRecord.sys_mod_count.toString()}.0</div>
<div class="kb_author">${gs.getMessage('Created at')}: ${knowledgeRecord.sys_created_on} ${gs.getMessage('by')} ${knowledgeRecord.author.getDisplayValue()}</div>
<g:evaluate var="jvar_time_ago_msg">
var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on");
gs.getMessage("Last modified at", timeAgo);
</g:evaluate>
<div class="kb_updated">${jvar_time_ago_msg} ${gs.getMessage('by')} ${knowledgeRecord.sys_updated_by}</div>
</div>
<!--Custom Code - End-->
<div id="articleFooterSection" class="snc-article-footer-section" style="display: none;">
<j:if test="${sysparm_no_rating != true}">
<div class="snc-article-footer-section-ratings">
<g:inline template="kb_view_ratings" />
</div>
</j:if>
<g:inline template="kb_article_comments" />
</div>
<j:if test="${isMobileView != true}" !>
<div id="articleFooter" class="snc-article-footer">
<g:inline template="kb_view_common_footer_metadata_fields" />
</div>
</j:if>
</j:jelly>
Please mark this as helpful... but only if it's helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 06:39 AM
You are correct you'd have to at the very least take ownership of "kb_view_common_footer" UI Macro.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 07:03 AM
Thanks for the tip! I do actually have ownership of that and have it pulled up. I'm not too familiar with Jelly scripting, but I guess all I have to do is find a way to reference some variables.
-----------------------------------------------------------------------------------------------------------------------------------
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:inline template="kb_view_common_footer_metadata_attachments" />
<g:inline template="kb_attached_tasks_v3"/>
<g:inline template="kb_affected_products_v3"/>
<div class="snc-article-header-author">
<j:choose>
<j:when test="${authorImage.length != 0}">
<img id="authorImage" class="snc-article-header-author-image" src="${authorImage}" />
</j:when>
<j:otherwise>
<div id="authorGhost" class="icon-user-profile snc-article-header-author-ghost" />
</j:otherwise>
</j:choose>
<div id="articleAuthor" class="snc-article-footer-metadata-published" style="display: block;padding-top: 5px">
${gs.getMessage('Authored by {0}', authorName)}
</div>
<g:evaluate var="jvar_time_ago_msg">
var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on");
gs.getMessage("Last modified {0}", timeAgo);
</g:evaluate>
<div id="articleModified" class="snc-article-footer-metadata-published">
${jvar_time_ago_msg}
</div>
</div>
<div id="articleFooterSection" class="snc-article-footer-section" style="display: none;">
<j:if test="${sysparm_no_rating != true}">
<div class="snc-article-footer-section-ratings">
<g:inline template="kb_view_ratings" />
</div>
</j:if>
<g:inline template="kb_article_comments" />
</div>
<j:if test="${isMobileView != true}">
<div id="articleFooter" class="snc-article-footer">
<g:inline template="kb_view_common_footer_metadata_fields" />
</div>
</j:if>
</j:jelly>
-----------------------------------------------------------------------------------------------------------------------------------

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 07:52 AM
Here is an un-styled implementation of the footer you've been asked to create:
"kb_view_common_footer" UI Macro.
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:inline template="kb_view_common_footer_metadata_attachments" />
<g:inline template="kb_attached_tasks_v3"/>
<g:inline template="kb_affected_products_v3"/>
<!--OOB Code - Start-->
<!--
<div class="snc-article-header-author">
<j:choose>
<j:when test="${authorImage.length != 0}">
<img id="authorImage" class="snc-article-header-author-image" src="${authorImage}" />
</j:when>
<j:otherwise>
<div id="authorGhost" class="icon-user-profile snc-article-header-author-ghost" />
</j:otherwise>
</j:choose>
<div id="articleAuthor" class="snc-article-footer-metadata-published" style="display: block;padding-top: 5px">
${gs.getMessage('Authored by {0}', authorName)}
</div>
<g:evaluate var="jvar_time_ago_msg">
var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on");
gs.getMessage("Last modified {0}", timeAgo);
</g:evaluate>
<div id="articleModified" class="snc-article-footer-metadata-published">
${jvar_time_ago_msg}
</div>
</div>
-->
<!--OOB Code - End-->
<!--Custom Code - Start-->
<div class="snc-article-header-author">
<div class="kb_version">${gs.getMessage('Version')}: ${knowledgeRecord.sys_mod_count.toString()}.0</div>
<div class="kb_author">${gs.getMessage('Created at')}: ${knowledgeRecord.sys_created_on} ${gs.getMessage('by')} ${knowledgeRecord.author.getDisplayValue()}</div>
<g:evaluate var="jvar_time_ago_msg">
var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on");
gs.getMessage("Last modified at", timeAgo);
</g:evaluate>
<div class="kb_updated">${jvar_time_ago_msg} ${gs.getMessage('by')} ${knowledgeRecord.sys_updated_by}</div>
</div>
<!--Custom Code - End-->
<div id="articleFooterSection" class="snc-article-footer-section" style="display: none;">
<j:if test="${sysparm_no_rating != true}">
<div class="snc-article-footer-section-ratings">
<g:inline template="kb_view_ratings" />
</div>
</j:if>
<g:inline template="kb_article_comments" />
</div>
<j:if test="${isMobileView != true}" !>
<div id="articleFooter" class="snc-article-footer">
<g:inline template="kb_view_common_footer_metadata_fields" />
</div>
</j:if>
</j:jelly>
Please mark this as helpful... but only if it's helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2016 08:07 AM
I actually was digging into it also. I found a nifty way to reference the updated by user to get the name by the user ID it stores. That way to reference the version count is genius also! Thank you so much for your help, it has been crucial!
<div class="snc-article-header-author">
<div id="articleAuthor" class="snc-article-footer-metadata-published" style="display: block;padding-top: 5px">
${gs.getMessage("Created at " + knowledgeRecord.getValue('sys_created_on') + " by {0}", authorName)}
</div>
<g:evaluate var="jvar_time_ago_msg">
<!-- var timeAgo = new GlideTimeAgo().getField(knowledgeRecord, "sys_updated_on"); -->
var updatedUser = gs.getUser().getUserByID(knowledgeRecord.getValue('sys_updated_by'));
gs.getMessage("Last modified at "+ knowledgeRecord.getValue('sys_updated_on') +" by "+ updatedUser.getDisplayName());
</g:evaluate>
<div id="articleModified" class="snc-article-footer-metadata-published">
${jvar_time_ago_msg}
</div>
</div>