await WOIRec.setCurrentSublistValue.promise({ ...
# ask-stanley-ai
r
await WOIRec.setCurrentSublistValue.promise({ sublistId: 'component', fieldId: 'quantity', value: 0 }); WOIRec is a WorkOrderIssue record get error value must be positive
c
AI generated answer (using internal Slack threads):
Based on the conversations, it seems like you're trying to set the quantity of a component in a WorkOrderIssue record to 0. However, you're encountering an error because the quantity value must be positive. In NetSuite, the quantity field in the component sublist of a WorkOrderIssue record represents the quantity of the component that is being issued. Therefore, it doesn't make sense to set this value to 0, as it would mean that no components are being issued. If you want to issue a WorkOrder without a specific component, you might want to consider not including that component in the WorkOrderIssue record at all, rather than trying to set its quantity to 0. Here's a sample code snippet for creating a WorkOrderIssue record without a specific component:
Copy code
javascript
var WOIRec = record.transform({
    fromType: record.Type.WORK_ORDER,
    fromId: workOrderId,
    toType: record.Type.WORK_ORDER_ISSUE,
    isDynamic: true,
});

// Loop through the components sublist
var numLines = WOIRec.getLineCount({ sublistId: 'component' });
for (var i = 0; i < numLines; i++) {
    var componentId = WOIRec.getSublistValue({ sublistId: 'component', fieldId: 'item', line: i });

    // If the component is the one you want to exclude, remove it from the sublist
    if (componentId == componentToExcludeId) {
        WOIRec.removeLine({ sublistId: 'component', line: i });
        break;
    }
}

var WOIRecId = WOIRec.save();
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.859788299
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836267769
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833207667
Please provide your feedback on this answer.