Article Body (text) field in Knowledge Base Articles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 11:05 AM
I import some knowledge articles from another system into a staging form. Now I'm trying to create a new Knowledge Article but the Article Body is blank after my GlideRecord. I've tried a couple of things:
This doesn't work (gr2.text is blank):
var gr = new GlideRecord('u_archive_obim_work_log');
gr.addEncodedQuery('u_new_kb_article_idSTARTSWITHKB0002716^u_kb_status=Published^u_kb_version=NULL');
gr.query();
while(gr.next()){
var gr2 = new GlideRecord('kb_knowledge');
gr2.addQuery('number', gr.u_new_kb_article_id);
gr2.query();
if(gr2.next()){
gr2.text = gr.u_template_question;
gr2.update();
gs.print(gr2.text);
}
}
This doesn't work (gr2.text is blank):
var gr = new GlideRecord('u_archive_obim_work_log');
gr.addEncodedQuery('u_new_kb_article_idSTARTSWITHKB0002716^u_kb_status=Published^u_kb_version=NULL');
gr.query();
while(gr.next()){
var gr2 = new GlideRecord('kb_knowledge');
gr2.addQuery('number', gr.u_new_kb_article_id);
gr2.query();
if(gr2.next()){
var q = gr.u_template_question.toString();
gr2.text = q;
gr2.update();
gs.print(gr2.text);
}
}
This works (but doesn't help me), gr2.text is now "test";
var gr = new GlideRecord('u_archive_obim_work_log');
gr.addEncodedQuery('u_new_kb_article_idSTARTSWITHKB0002716^u_kb_status=Published^u_kb_version=NULL');
gr.query();
while(gr.next()){
var gr2 = new GlideRecord('kb_knowledge');
gr2.addQuery('number', gr.u_new_kb_article_id);
gr2.query();
if(gr2.next()){
gr2.text = "test";
gr2.update();
gs.print(gr2.text);
}
}
I know the Article Body field is a "Translate HTML" field. Is there a way to copy data to this field (not manually). My gr.u_new_kb_article_id was first a string field, then I changed it to an HTML field and it still does not work.
Anyway to do this?
Lisa

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 11:24 AM
Did you try
var gr = new GlideRecord('u_archive_obim_work_log');
gr.addEncodedQuery('u_new_kb_article_idSTARTSWITHKB0002716^u_kb_status=Published^u_kb_version=NULL');
gr.query();
while(gr.next()){
var gr2 = new GlideRecord('kb_knowledge');
gr2.addQuery('number', gr.u_new_kb_article_id);
gr2.query();
if(gr2.next()){
var q = gr.getValue('u_template_question');
gr2.text = q;
gr2.update();
gs.print(gr2.text);
}
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 01:01 PM
I just tried your suggestion and it's still giving me nothing in the gs.print(gr2.text) script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 02:09 PM
Can you also print 'q' to see, if you are getting any value in it?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2019 11:41 AM
I'm not getting any value for q. I just decided to manually update each article.