HELLO ALL, I am getting this error in setting up t...
# suitescript
v
HELLO ALL, I am getting this error in setting up the sublist value. what could be the reason? Could anyone please help? "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. Thank you
s
Might help to descibr what youre trying to do followed by some code
v
customerPaymentRecord
.setValue({fieldId : 'customer',value : customer}) .setValue({fieldId : 'custrecord_dyn_mf_transactions_id', value : transactionIds}) .setValue({fieldId : 'custrecord_dyn_journal_dd', value : journal}) .setValue({fieldId : 'payment', value : totalAmount}); var linecount = customerPaymentRecord.getLineCount('apply'); log.debug('linecount',linecount); //9 for(var i = 1; i<=transactionIdsCount; i++){ //5 var internalId = customerPaymentRecord.getSublistValue({ sublistId : 'apply', fieldId : 'internalid', line : i }); log.debug('i',i) log.debug('internalId',internalId); for(var j = 0; j<linecount; j++){ var IndividualTransactionId = splitter[j]; log.debug('IndividualTransactionId',IndividualTransactionId); if (internalId === IndividualTransactionId){ log.debug('entering if'); customerPaymentRecord.setValue({ sublistId : 'apply', fieldId : 'apply', line : i, value : true }); customerPaymentRecord.commitLine({ sublistId: 'apply'}); } } }
comparing the value, if it is then setting the checkbox true.
s
What type of script is this?
UE?
s
Looks like you're mixing up dynamic and standard mode
.setValue can't set a sublist value
👍 1
r
In your for loop, lines should start from index 0.
👍 1
iirc indexing starting with 1 is SS1.0.
v
Thank you all. It works fine now