RE: SS 2.0 Render Multpage PDF

Hello, i am trying to take an array of transactions and make a single PDF from them.  Below is my code and the error I receive.

var arrIFIdsCreated = [466042];//, 466034];
                    var xml = "";
                    var fileToLoadId = 215824;  //'Templates/PDF Templates/custtmpl_115_4522646_593.template.xml'
                    var xmlTemplateFile = file.load({id: fileToLoadId});
                    for(var i = 0; i < arrIFIdsCreated.length; i++ ){
                        var renderer = render.create();
                        renderer.templateContent = xmlTemplateFile.getContents();
                        renderer.addRecord('record', record.load({
                                                        type: record.Type.ITEM_FULFILLMENT,
                                                        id: arrIFIdsCreated[i]
                        }));
                        xml = xml + renderer.renderAsString();
                        //
                        // if(i < arrIFIdsCreated.length - 1){
                        //     xml = xml + "<pbr/>";
                        // }
                    }
                    xml = xml + "</body></pdf>";
                    var pdfFileObj  = render.xmlToPdf({xmlString: xml});
                    pdfFileObj.folder = 63216;
                    pdfFileObj.name = 'test.pdf';
                    var fileId = pdfFileObj.save();
                    log.debug('notes', 'filed id: ' + fileId);
 The error I am receiving
                    {“type”:”error.SuiteScriptError”,”name”:”USER_ERROR”,”message”:”Error Parsing XML: The reference to entity \”c\” must end with the ‘;’ delimiter.”,”stack”:[“createError(N/error)”,”onRequest(/SuiteScripts/Somnomed-Prod/sm_sl_mass_fulfill_so.js:230)”],”cause”:
Link to xml file

 

plv_2002 Rookie Asked on September 20, 2019 in SuiteScript.
Add Comment
1 Answers

I’ve seen that before when using URLs. The entity c refers to a &c=x in the string.

Rookie Answered on September 20, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.