- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 12:10 AM
Hi,
Currently I am trying to display the information message, when I open a knowledge article through the knowledge search under the self-service application depending upon the state. Have anybody worked on such kind of requirement or if have any ideas could you please help me in achieving this.
Regards,
Dinesh Kumar.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 01:15 AM
Hi Dinesh, please see in the below code in bold "Congratulations you got a message" the places where you will like to add your message
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j2:set var="jvar_hide_response_time" value="true" />
<g:inline template="ie_checker.xml" />
<g:requires name="scripts/lib/jquery_includes.js"/>
<g:requires name="styles/knowledge.ng/css_includes_knowledge.css" includes="true"/>
<j2:if test="$[!jvar_isMSIE7]">
<j2:if test="$[!jvar_isMSIE8]">
<g:requires name="scripts/classes/timeAgo.js"/>
</j2:if>
</j2:if>
<!-- Common styles are loaded in the "Knowledge Common Styles" stylesheet -->
<link href="b3ba3821d73221004792a1737e610382.cssdbx?v=${gs.getProperty('glide.builddate')}" type="text/css" rel="stylesheet"/>
<g:evaluate jelly="true" copyToRhino="true">
var uiMacro = "kb_view_legacy";
var kbViewModel = new KBViewModel();
var kbViewInfo = kbViewModel;
kbViewModel.getInfo();
var canContributeHelper = new SNC.KnowledgeHelper();
var knowledgeHelp = new KnowledgeHelp();
var historyRowCount = 0;
var isValidRecord = kbViewModel.isValid;
var knowledgeExists = kbViewModel.knowledgeExists;
var NOT_RETIRED = gs.getMessage("Article not retired");
var NOT_PUBLISHED = gs.getMessage("Article not published");
var NOT_SAVED = gs.getMessage("Article not saved");
var SAVED = gs.getMessage("Article saved");
var DISCARDED = gs.getMessage("Article changes discarded");
var SUBMITTED = gs.getMessage("Your article has been submitted");
var PREVIEW = gs.getMessage(" Preview ");
var PREVIEW_HINT = gs.getMessage("Preview changes");
var DELETE = gs.getMessage("Delete");
var CONFIRM_DELETE = gs.getMessage("Confirm deletion of this article and all its revisions?");
var TITLE_CANCEL = gs.getMessage("Cancel changes");
var MESSAGE_CANCEL = gs.getMessage("Discard all changes?");
var TITLE_RETIRE = gs.getMessage("Retire");
var MESSAGE_RETIRE = gs.getMessage("Retire this article?");
// Status messages for the message bar.
var DRAFT_MSG = gs.getMessage("This knowledge item has been created");
var REVIEW_MSG = gs.getMessage("This knowledge item has been published");
var PUBLISHED_MSG = gs.getMessage("This knowledge item has been published");
var PEND_RETIRE_MSG = gs.getMessage("This knowledge item has been retired");
var RETIRED_MSG = gs.getMessage("This knowledge item has been retired");
var DELETE_FAIL_MSG = gs.getMessage("This article could not be deleted");
var TXT_PLACEHOLDER = gs.getMessage("Add content");
if (isValidRecord) {
var knowledgeRecord = kbViewModel.knowledgeRecord;
var canContributeToKnowledge = canContributeHelper.canContribute(kbViewModel.knowledgeRecord);
var publishedRecord = kbViewModel.publishedRecord;
var feedbackRecords = kbViewModel.feedbackRecord;
var bannerImage = kbViewModel.bannerImage;
var authorImage = kbViewModel.authorImage;
var authorName = kbViewModel.authorName;
var authorCompany = kbViewModel.authorCompany || kbViewModel.getAuthorInfo("author.company.name");
var authorDepartment = kbViewModel.authorDepartment || kbViewModel.getAuthorInfo("author.department.name");
var authorTitle = kbViewModel.authorTitle || kbViewModel.getAuthorInfo("author.title");
var i18n = function(message, array) {
message = message || "";
var padded = " " + message + " ";
var translated = gs.getMessage(padded, array);
var trimmed = translated.trim();
return trimmed;
};
var canCreateNew = kbViewModel.canCreateNew;
var isNewRecord = kbViewModel.isNewRecord;
var published = "";
var sys_updated_on = "";
if (kbViewModel.publishedRecord) {
published = kbViewModel.publishedRecord.published;
sys_updated_on = kbViewModel.publishedRecord.sys_updated_on;
}
var number = knowledgeRecord.number;
var permalink = kbViewModel.permalink;
var category = knowledgeRecord.category;
var attachments = kbViewModel.attachments;
var disableSuggesting = knowledgeRecord.disable_suggesting;
var glideWikiModel = new GlideWikiModel();
glideWikiModel.setLinkBaseURL(glideWikiModel.getLinkBaseURL() + "${AMP}sysparm_field=kb_knowledge.wiki" + "${AMP}sysparm_kbtable=" + kbViewInfo.tableName);
var relatedContent = kbViewInfo.relatedContent || kbViewInfo.getCurrentRelatedContent();
}
var isVersion2 = new KBCommon().isKBVersion2(knowledgeRecord.kb_knowledge_base);
if (isVersion2) {
if (jelly.sysparm_context == 'popup')
uiMacro = "kb_view_legacy_popup";
else
uiMacro = "kb_view_legacy";
}
</g:evaluate>
<script>
var kbConfig = {
canContribute: '${canContributeToKnowledge}',
historyRowCount: ${historyRowCount},
i18n: {
STATUS_MSG: {
draft: '${DRAFT_MSG}',
review: '${REVIEW_MSG}',
published: '${PUBLISHED_MSG}',
pending_retirement: '${PEND_RETIRE_MSG}',
retired: '${RETIRED_MSG}',
delete_failed: '${DELETE_FAIL_MSG}'
},
TXT_PLACEHOLDER: '${TXT_PLACEHOLDER}',
NOT_RETIRED: '${NOT_RETIRED}',
NOT_PUBLISHED: '${NOT_PUBLISHED}',
NOT_SAVED: '${NOT_SAVED}',
SAVED: '${SAVED}',
DISCARDED: '${DISCARDED}',
SUBMITTED: '${SUBMITTED}',
PREVIEW: '${PREVIEW}',
PREVIEW_HINT: '${PREVIEW_HINT}',
CONFIRM_DELETE: '${CONFIRM_DELETE}',
DELETE: '${DELETE}',
TITLE_RETIRE: '${TITLE_RETIRE}',
MESSAGE_RETIRE: '${MESSAGE_RETIRE}',
TITLE_CANCEL: '${TITLE_CANCEL}',
MESSAGE_CANCEL: '${MESSAGE_CANCEL}'
}
};
$j(function() {
if (parent.document) {
// fix iframe resize issue for CMS service portal
parent.CustomEvent.fire('content_frame.resized', window.name, parent.document.body.scrollHeight);
}
});
</script>
<j:choose>
<j:when test="${isVersion2}">
Congratulations you got a message 1!
<g:inline template="${uiMacro}"/>
</j:when>
<j:when test="${isValidRecord && knowledgeHelp.hasRights(knowledgeRecord)}">
Congratulations you got a message 2!
<g:inline template="kb_view_common" />
</j:when>
<j:when test="${knowledgeExists}">
Congratulations you got a message 3!
<g:inline template="kb_view_cannot_read"/>
</j:when>
<j:otherwise>
<g:inline template="kb_view_not_valid_record"/>
</j:otherwise>
</j:choose>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 12:16 AM
Hi, you could do this by modifying the kb_view UI page.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 12:24 AM
Hi Berny,
When we are searching the articles by giving the article search words in the search box, we are getting all the articles that are created with those texts, so out of those articles when we click on the required article to open, we need to get the information message. Is this possible. Also, it would be great if you can share, some pointers regarding how to implement this functionality as I am new to jelly.
Regards,
Dinesh Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 12:30 AM
Hi Dinesh, yes. It's possible The UI page that it's invoked is the kb_view one.
I hope this is helpful! I will try soon to provide some further pointer of where to do the change
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2015 12:32 AM
Thanks Berny