
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 09:23 AM
Hi All,
Widget -- > myHR KB Article Page
Server Code snippet
t.text = new global.KBViewModel().getArticleContentBySysId(articleGR.getUniqueValue());
Script Include : KBViewModel --- > overriding the KBViewModelSNC
getArticleContentBySysId : function(articleSysId){ // OOB CODE
var gr = new GlideRecord("kb_knowledge");
var userId = gs.getUserID();
if(!articleSysId || !gr.get(articleSysId) || !gr.canRead())
return '';
this.knowledgeRecord = gr;
if(!this.tableName)
this.tableName = gr.sys_class_name + '';
if(!this.articleTemplateName)
this.articleTemplateName = this._knowledgeHelper.getArticleTemplateName(gr.sys_class_name) || '';
gs.info('article template name is:'+this.articleTemplateName);
gs.info('article content is:'+this.getArticleContent());
return this.getArticleContent();
},
However the article content is returning as empty when the article is created on HR knowledge (u_kb_template_hr_knowledge) table and when knowledge blocks are applied to it.
But when the article is created on kb_knowledge table and when I apply the blocks to it, it is rendering correctly the KB blocks correctly.
Can anyone please help me what the issue is ?
Help is appreciated.
Regards,
Dheeraaj
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2019 08:38 AM
Hi Ali,
I have figured out a way to do implement this and now its working super good.
For anyone trying to implement the similar functionality, for the kb blocks to get rendered in the service portal for a different template other than the standard, the article along with the block should get populated in the KB Knowledge to Block History table.
Regards,
Dheeraaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 09:41 AM
Hi Dheeraj,
Can you tell me what are you trying to achieve here. What is your use case with blocks.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 09:52 AM
Hi Ali,
Thanks for replying. Out of the box we have a functionality to create knowledge blocks on the kb_knowledge table.
Knowledge blocks are used to restrict content based on the user criteria.
For ex:
A single knowledge article appears differently when a user from Japan views the article and appears differently when a person from US views it. Please find the attachments. In the 1st attachment[This article was created on the HR knowledge (u_kb_template_hr_knowledge) table]., it is not displaying the knowledge block content.
Where as in the 2nd , it is showing us the content how a japan user sees it. [ This article was created on the kb_knowledge] table.
Now, I want to achieve the similar functionality on the
HR knowledge (u_kb_template_hr_knowledge) table.
However I am unable to render Knowledge blocks using the code above on HR knowledge table.
Regards,
Dheeraaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 10:00 AM
Why do you have custom table, what is its purpose? Is it extended from kb_knowledge?
I have worked with blocks and its rendering is a complicated feature. There can be several impacts when you customize it this way

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2019 10:09 AM
Hi Ali,
I am not sure of the purpose, but yes it is extended from Knowledge table.
Regards,
Dheeraaj