I set the value to a sublist field, but its not re...
# general
v
I set the value to a sublist field, but its not reflecting. what could be the reason
b
share the code
j
Where and how did you set it?
v
define([ 'N/record', 'N/search'], function(record,search){ function afterSubmit(context){ var journal = context.newRecord; var journalId = journal.id; var journalLineCount = journal.getLineCount({sublistId : 'line'}); var wcwLocationPOLine; var purchaseOrderSavedSearch = search.create({ type: 'purchaseorder', filters: [ ['mainline','is','F'], "AND", ['applyinglinktype','anyof','BillVar'], 'AND', ['applyingtransaction','anyof',journalId], 'AND', ['type','anyof','PurchOrd'] ], columns: [ search.createColumn({name:'line.cseg_cmb_wcw_loc', label: 'WCW Location'}) ] }); purchaseOrderSavedSearch.run().each(function(result){ wcwLocationPOLine = result.getValue({name : 'line.cseg_cmb_wcw_loc'}); log.debug('wcwLocationPOLine',wcwLocationPOLine); return true; }); for(var j=0; j<journalLineCount; j++){ log.debug('journalsublistLinenumber', j); journal.setSublistValue({ sublistId : 'line', fieldId : 'cseg_cmb_wcw_loc', line : j, value : wcwLocationPOLine }); /*journal.commitLine({ sublistId: 'item' });*/ } journal.save(); } return{ afterSubmit : afterSubmit } } );
b
go through the limitations of afterSubmit
v
ok thank you @battk