UI Action to Export Data in Word

mauro23
Kilo Contributor

hello,

In order to allow the export of a record in Word, I found a possible solution by creating a contract template (a servicenow plugin ), which contains the word template with which I want to download the export. I'm trying to create a ui action to allow this download but I can't link to the contract template and can't download it, can anyone help me?

 

 

 

function testExport() {
    
    gsftSubmit(null, g_form.getFormElement(), 'testExport');
}

if (typeof window == 'undefined')
    exportToWord();

function exportToWord() {
   
    var gr = new GlideRecord('sn_doc_word_template');
    gr.addQuery('name', 'Template Test);
    gr.query();

    if (gr.next()) {
        var templateSysId = gr.sys_id.toString();
        var templateName = gr.getValue('name');
        //var templateContent = gr.getValue('document');

        var recordSysId = current.sys_id.toString();
       
        new sn_doc.GenerateDocumentAPI().generateDocumentForTask(recordSysId, templateSysId, templateName);
        action.setRedirectURL(current);
    }
   
}

 

0 REPLIES 0