Darren
04/08/2020, 12:01 PMcreditMemoRecord.setValue('autoapply', false);
let payAmount = Number(creditMemoRecord.getValue('amountremaining'));
for (let lineIndex = 0; lineIndex <= creditMemoRecord.getLineCount('apply'); lineIndex++){
if (invoiceId == creditMemoRecord.getSublistValue('apply', 'doc', lineIndex)) {
didApply = true;
creditMemoRecord.selectLine({ sublistId: 'apply', line:lineIndex });
creditMemoRecord.setCurrentSublistValue({ sublistId: 'apply', fieldId: 'apply', value: true });
creditMemoRecord.setCurrentSublistValue({ sublistId: 'apply', fieldId: 'amount', value: payAmount });
}
}
I get the following error:
{
"error": {
"code": "SSS_INVALID_SUBLIST_OPERATION",
"message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"SSS_INVALID_SUBLIST_OPERATION\",\"message\":\"You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.\",\"stack\":[\"Error\"],\"cause\":{\"type\":\"internal error\",\"code\":\"SSS_INVALID_SUBLIST_OPERATION\",\"details\":\"You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.\",\"userEvent\":null,\"stackTrace\":[\"Error\"],\"notifyOff\":false},\"id\":\"\",\"notifyOff\":false,\"userFacing\":true}"
}
}
Does anyone have any idea why this would be failing? There's no issue via the UI doing this.battk
04/08/2020, 12:21 PM<=
: causes the error at the last iteration of your loopDarren
04/08/2020, 12:33 PMDarren
04/08/2020, 12:33 PMDarren
04/08/2020, 12:38 PM