Article Body (text) field in Knowledge Base Articles

kemmy1
Tera Guru

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

 

8 REPLIES 8

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

Did you go to the knowledge article and see if it has been updated or not?

 

Thanks,

Ashutosh

Yes, the knowledge article itself still has nothing in the Article Body field. 

vkachineni
Kilo Sage

Is there a create ACL blocking the update?

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

I don't think so, but I'll check.  I updated all the other fields (category, short description) just fine.