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

  • Author
    Posts
  • #6165

    Esidedob

    I am trying to create a script to generate PDF document from SO. I had no issues making it work as long as I use fields and sublists from sales order. But it seems I cannot get any values from linked customer record. I followed these steps:

    1. Created suitelet that generates PDF file using nlapiXMLToPDF

    2. Created client script to call on suitelet and pass internal id

    3. created user event script to create a button on SO form

    Code:
    function printLabels(request, response) {
    //retrieve the record id passed to the Suitelet
    var recId = request.getParameter(‘id’);

    //load records
    var recSO = nlapiLoadRecord(‘salesorder’, recId);
    var companyInfo = nlapiLoadConfiguration(‘companyinformation’);
    var recShipAddress = recSO.viewSubrecord(‘shippingaddress’);
    var recBillAddress = recSO.viewSubrecord(‘billingaddress’);
    var customerId = nlapiGetFieldValue(‘entity’);

    // load the customer record using the internal id acquired above
    var customerRec = nlapiLoadRecord(‘customer’, customerId, {recordmode : ‘dynamic’});
    ——

    As soon as I added : var customerId = nlapiGetFieldValue(‘entity’);

    var customerRec = nlapiLoadRecord(‘customer’, customerId, {recordmode : ‘dynamic’});

    I keep getting “SSS_MISSING_REQD_ARGUMENT” and cannot source any fields from customer record. I am completely new to sutescript. Any help will be greatly appreciated. Thanks
    This is a cached copy. Click here to see the original post.

  • #6166

    Olivier Gagnon NC

    You are on a Suitelet. There are no local field value because there is no local record. nlapiGet anything will not work.Looking at this code, I believe you mean to say var customerId = recSO.getFieldValue(‘entity’)

  • #6167

    chanarbon

    Originally posted by Olivier Gagnon NC

    View Post

    You are on a Suitelet. There are no local field value because there is no local record. nlapiGet anything will not work.Looking at this code, I believe you mean to say var customerId = recSO.getFieldValue(‘entity’)

    I agree with Olivier. Please note that the use of nlapiGet or nlapiSet vs a record is done on either user event script and client script script because your working on the context of a record. When dealing with Suitelet or other server side scripts, you have to use the getting and setting on the nlobjRecord which on this case is the recSo.

You must be logged in to reply to this topic.