Hi all, any idea why these lines wont commit? I ha...
# suitescript
p
Hi all, any idea why these lines wont commit? I have a loop in a clientscript adding items to an estimate in edit mode. it selects a new line, put in the item and quantity values but never commits it. then in the next iteration of the loop, it just overrides the last item with the new one and dont commit that either.
Copy code
currentRecord.selectNewLine({
                            sublistId: 'item'
                        });
                        
                        currentRecord.setCurrentSublistValue({
                            sublistId: 'item',
                            fieldId: 'item',
                            value: itemId
                        });

                        currentRecord.setCurrentSublistValue({
                            sublistId: 'item',
                            fieldId: 'quantity',
                            value: quantity
                        });

                        currentRecord.commitLine({
                            sublistId: 'item'
                        });
b
my first attempt would be disabling other workflows and client scripts
p
ill look into that, thanks
b
second would be using forceSyncSourcing
Copy code
currentRecord.selectNewLine({
  sublistId: "item"
});

currentRecord.setCurrentSublistValue({
  sublistId: "item",
  fieldId: "item",
  value: itemId,
  forceSyncSourcing: true
});

currentRecord.setCurrentSublistValue({
  sublistId: "item",
  fieldId: "quantity",
  value: quantity,
  forceSyncSourcing: true
});

currentRecord.commitLine({
  sublistId: "item"
});
although to be honest, i've only had to use that when things are slow, which is usually caused by scripts/workflows
p
forceSyncSourcing worked, thanks! was looking into insertLine and the commitLine docs, dont know why it didnt occur to me to look at the set value docs xD