on the item record, the location is a sublist? how...
# suitescript
s
on the item record, the location is a sublist? how can i access via a script?
e
do you mean the inventory sublist?
s
Yes
I need to set a sepcfic location reorderpoint to 0
e
Copy code
itemRecord.setSublistValue({
                sublistId: 'location',
                fieldId: 'reorderpoint',
                line: /// whatever line number youre setting,
                value: /// whatever you want to set the reorder point to
            })
Where itemRecord is…
Copy code
var itemRecord = record.load({
                            type: record.Type.INVENTORY_ITEM,
                            id: itemId
                        });
b
Inventory Part - locations reasonable start to find ids
s
this is the current script
Copy code
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */
define([], function () {
    function beforeLoad(context) {

        context.newRecord.setValue({ fieldId: 'autopreferredstocklevel', value: false });
        context.newRecord.setValue({ fieldId: 'autoreorderpoint', value: false});
        context.newRecord.setValue({ fieldId: 'taxschedule', value: "1" });
        test  = context.newRecord.getValue({ fieldId: "locations" });
      log.debug({title: test,
                 details:test})
    }
    return {
        beforeLoad: beforeLoad,
    };
});
this is actually asembally
e
The first issue here is that these fields cannot be set with a beforeLoad script
s
it works so far
b
Assembly Item - locations same basic idea for assembly items
find the correct ids to use with Record.setSublistValue
for your beforeLoad, only expect it to work on create
if you want a robust script, use Record.findSublistLineWithValue to find your matching line number
otherwise hope nobody inactivates a location and hardcode the line
s
ok if im using set sublistvalue , what is the sublist id -- is that the internal id of the location ?
b
internal id of the sublist, i recommend the record browser to find that
s
the truth i need that whole location on all items for reorder point set to 0