no need for `line` when using the `current` api ca...
# beginners
a
no need for
line
when using the
current
api calls
r
I am getting error same..can you cheak my code script..
define(['N/record'], function(record) { //load purchase order by id function close_purchaseOrder_by_id(context) { try { if (context.type !== context.UserEventType.CREATE) { var recordId = context.newRecord.id; log.debug('recordId', recordId); var current_purchase_order = record.load({ type: record.Type.PURCHASE_ORDER, id: recordId, isDynamic: true }); log.debug('objRecord', JSON.stringify(current_purchase_order)); //item count var numLines = current_purchase_order.getLineCount({ sublistId: 'item' }); log.debug('numlines', numLines); //closed status by true for (var i = 0; i < numLines; i++) { var isClosed_status = current_purchase_order.getSublistValue({ sublistId: 'item', fieldId: 'isclosed', line:i }); log.debug('Get Values', isClosed_status); if (isClosed_status == '' || isClosed_status == 'false') { //current_purchase_order.setCurrentSublistValue('item','isclosed',i,true); var finalchange = current_purchase_order.setCurrentSublistValue({ sublistId: 'item', fieldId: 'isclosed', value: true }); current_purchase_order.commitLine({sublistId: 'item'}); }
a
check out the suiteanswer "Working with Sublists in Dynamic Mode and Client SuiteScript" (answer id: 15030)
it's 1.0 but the same logic applies to 2.0
r
Is this problem solved or still facing issue?