This topic contains 4 replies, has 2 voices, and was last updated by Adolfo Garza 6 years, 4 months ago.

  • Author
    Posts
  • #19018

    Iris Tan
    Member
    @iris_tan

    Hi,

    We’ve recently enabled advance item location configuration which means we can no longer mass update reorder points & preferred stock level via csv or standard mass update (have also verified with NetSuite support that this is an enhancement request).

    We have over 1000 items that need to be updated so we are going to go with a mass update script however when we run the below, it is throwing this error:ย <span style=”color: #222222; font-family: sans-serif; font-size: 13px;”>Cannot find function setLineItemvalue in object nlobjRecord</span>

    Does anyone know what the function should be to update an inventory location line or have I got the wrong format somewhere in the script below?

    function updReorderPoint(rec_type, rec_id)

    {

    var itemRec = nlapiLoadRecord(rec_type, rec_id)

    var line = itemRec.findLineItemValue(‘locations’,’location’,1);

    itemRec.setLineItemValue(‘locations’,’reorderpoint’, line, null);

    itemRec.setLineItemvalue(‘locations’,’preferredstocklevel’, line, null);

    nlapiSubmitRecord(itemRec);

    }

    Thanks!

    Iris

     

     

  • #19020

    Adolfo Garza
    Member
    @adolfo_garza

    The code you entered in the lower section doesn’t match the error you described. The error you described says “Cannot find function setLineItemvalue in object nlobjRecord” which has “setLineItemvalue” mispelled, it should be “setLineItemValue”

  • #25506

    Iris Tan
    Member
    @iris_tan

    Ah thanks Adolfo! How embarrassing. I’m new to scripting. Have fixed that up. Next challenge is trying to target the right field in the sublist as the script runs fine but the values are not being updated. have tried Null or a numeric value but it is not updating. Have also ensure auto reorder points and auto preferred stock level is unchecked.

  • #25507

    Iris Tan
    Member
    @iris_tan

    Resolved! Posting the script here and hopefully it helps someone in the future. Item Location Configuration is a separate record type to item.

    function updReorderPoint(rec_type, rec_id)

    {

    var itemRec = nlapiLoadRecord(rec_type, rec_id)

    itemRec.setFieldValue(‘reorderpoint’, null);

    itemRec.setFieldValue(‘preferredstocklevel’, null);

    nlapiSubmitRecord(itemRec);

    }

  • #26039

    Adolfo Garza
    Member
    @adolfo_garza

    Awesome! Thanks for sharing.

You must be logged in to reply to this topic.