I am attempting to update a field on the line leve...
# suitescript
j
I am attempting to update a field on the line level of an Inventory Adjustment with a client script, but I am getting an error. Am I doing something wrong here?
Code: var recobj = nlapiLoadRecord("inventoryadjustment", 28093); recobj.setLineItemValue('item','custcol_eqvpiece',3,"-3"); nalpiSubmitRecord(recobj, true);
Error: NLAPI.jsp?NS_VER=2019.2.0&minver=145&JSP_VER=1&locale=en_US:4845 Uncaught nlobjError {id: null, code: "SSS_INVALID_SUBLIST_OPERATION", details: undefined, stacktrace: "stacktrace: function nlobjError( code, error, supp…)↵arguments: {'item','custcol_eqvpiece',3,'-3'}↵↵", suppressnotification: undefined, …}
b
inventory adjustments dont have an item sublist
j
ok - full disclosure, I'm a functional Administrator, and barely utilize client scripts, ones provided to me by our developer who is overseas and I cannot contact her right now. I don't understand very much out of the link you sent.
do I remove the 'item' from the second line to get my desired result?
b
its a list of sublist ids and field ids for inventory adjustments
j
ok - I see 'item' on that list though?
b
there is a different between a sublist id and a field id
j
okay, soo what am I doing wrong?
if I just need to update the value of a custom field on the line level on the IA, what should I be using? This was the client script she had provided to me to use for a similar situation
b
your error is netsuite telling you that you are performing an invalid sublist action
in this case, you are trying to set a field on the non-existant item sublist
it might also be that there is no 3rd line on your adjustment
j
ok so which sublist do I need to call to be able to update that field then? the only ones on that list that I think could be correct are 'line' or 'label'
b
the fix is to find the proper id for the sublist you are working with
j
there is, I double checked the xml, there's 5 total lines, numbered 1-5
ok, would I be able to find that in the xml?
Record.getSublists() ??
b
there are many ways to find sublist ids
a quick, though somewhat inaccurate way is to use the name of the subtab the sublist is in
Record.getSublists should get you an array of sublist ids on your record
the name of the sublist should also be in the machine element of the xml
j
<machine name="inventory" type="edit" fields="line,item,description,location,units,quantityonhand,currentvalue,adjustqtyby,newquantity,unitcost,inventorydetail,department,class,custcol_qtymt,custcol_ratemt,custcol_eqvpiece,custcol_lotinternalid,custcol_productcategory,costingmethod,unitconversionrate,invtdiffvalue,avgunitcost,adjustqtybytype,inventorydetailavail,inventorydetailreq,binitem,isserial,isnumbered,locationusesbins,isinvdetaildirty,inventorydetailset,memo">
so 'inventory' ?
that worked. OMG @battk you're awesome. Thank you for your patience and for teaching me something new today!! It's highly appreciated. You're always extremely helpful to me!