This topic contains 2 replies, has 0 voices, and was last updated by Karl_Europart 7 years, 8 months ago.

  • Author
    Posts
  • #2246

    Karl_Europart

    Hi,

    I am looking to try and sort an item label which loads from the item record via a button.

    We are using the standard item label but i need to create a BFO PDF document for a new item label which is the same as our standard except it uses different languages. So i would have a different button in the drop down on an item record at the top to print which langauge they select.

    In this case it is the french language.

    I have been told to create a User Event Script to create the button called Print French Label on a beforeload function. Then i need to insert the setScript function which will call the client script to load the pdf.

    The above is all ok but the XMLtoPDF for an item label is the issue as have never had any experience with this and we have no budget to get our partner to sort this for us.

    I am wondering if there is anyone out there that has a good heart and some free time to help me out.

    Thanks in advance

    Karl
    This is a cached copy. Click here to see the original post.

  • #2247

    michoel

    You are in luck, I’ve done basically this exact customization:

    Code:
    /**
    * Add ‘Print Item Labels’ button to Item Page
    *
    * Script ID: customscript_mos_itemlabels_ue
    * Script Type: User Event
    * Deployed to: Inventory Item
    *
    */

    function beforeload(type, form) {
    if (type == ‘view’) {
    var script = “window.open(nlapiResolveURL(‘SUITELET’, ‘customscript_mos_itemlabels_sl’, ‘customdeploy_mos_itemlabels_sl’) + ‘&custom_id=’ + nlapiGetRecordId());”;
    form.addButton(‘custpage_printitemlabel’, ‘Print Item Label’, script);

    }
    }

    /**
    * Suitelet to print Item Label
    *
    * Script ID: customscript_mos_itemlabels_sl
    * Script Type: Suitelet
    *
    */

    function suitelet(request, response) {
    try {

    var id = request.getParameter(‘custom_id’);
    if (!id) {
    response.write(‘custom_id parameter missing’);
    }

    var record = nlapiLoadRecord(‘inventoryitem’, id);
    var renderer = nlapiCreateTemplateRenderer();
    var template = nlapiLoadFile(‘SuiteScripts/MOS Advanced PDF Forms/Item Label.xml’);
    renderer.setTemplate(template.getValue());
    renderer.addRecord(‘record’, record);
    var xml = renderer.renderToString();
    var pdf = nlapiXMLToPDF(xml);
    response.setContentType(‘PDF’, ‘itemlabel.pdf’, ‘inline’);
    response.write(pdf.getValue());

    } catch (err) {
    response.write(err + ‘ (line number: ‘ + err.lineno + ‘)’);
    return;
    }
    }

    HTML Code:

    h1 {
    font-family: sans-serif;
    font-weight: bold;
    font-size: 9mm;
    line-height: 100%;
    text-align: center;
    align: center;
    }

    h2 {
    margin-top: 2mm;
    font-size: 4.5mm;
    line-height: 100%;
    font-weight: normal;
    text-align: center;
    align: center;
    }

    ${record.itemid?upper_case}

    ${record.salesdescription?upper_case}

  • #2248

    Karl_Europart

    Thank you very much for the above.

    I have a question though, Would you be able to help me build the PDF Label as i have no experience in bigfaceless etc. I can send you the layout and you could see if was possible.

    Also do you know if a translated description could be incorporated into the pulling of values as NetSuite support have said it can be using the SuiteAnswers ID of SuiteAnswer 28342 : “Print Item details in Multiple Languages using nlapiXMLToPDF()”

You must be logged in to reply to this topic.