Junelle Sambat
02/16/2023, 1:25 AMJunelle Sambat
02/16/2023, 1:28 AMJunelle Sambat
02/16/2023, 1:28 AMvar objNewSo = record.copy({
type: record.Type.SALES_ORDER,
id: objData.salesOrder,
isDynamic: true
// isDynamic: false
})
var intEntity = objNewSo.getValue({fieldId: 'entity'})
log.debug('intEntity', intEntity)
var currentSubsidiary = objNewSo.getValue({fieldId: 'subsidiary'})
log.debug('currentSubsidiary', currentSubsidiary)
// objNewSo.setValue({fieldId: 'entity', value: ''})
objNewSo.setValue({fieldId: 'entity', value: intEntity})
var itemLineCount = objNewSo.getLineCount({sublistId: 'item'})
var newSubsidiary = mappingSubsidiary[currentSubsidiary]
log.debug('newSubsidiary', newSubsidiary)
objNewSo.setValue({fieldId: 'subsidiary', value: newSubsidiary})
log.debug(' mappingSubsidiary[currentSubsidiary]', mappingSubsidiary[currentSubsidiary])
var currentLocation = objNewSo.getValue({fieldId: 'location'})
log.debug('currentLocation', currentLocation)
objNewSo.setValue({fieldId: 'location', value: locationMapping[currentLocation]})
log.debug(' locationMapping[currentLocation]', locationMapping[currentLocation])
var poNUmber = objNewSo.getValue({fieldId: 'otherrefnum'})
log.debug('poNUmber', poNUmber)
objNewSo.setValue({fieldId: 'otherrefnum', value: poNUmber + ' new'})
//get item line count
for (var i = 0; i < itemLineCount; i++) {
var currentLine = objNewSo.SelectLine({sublistId: 'item', line: i})
currentLine.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'inventorylocation',
value: locationMapping[currentLocation]
})
currentLine.commitLine({sublistId: 'item'})
// objNewSo.setSublistValue({
// sublistId: 'item',
// fieldId: 'inventorylocation',
// line: i,
// value: locationMapping[currentLocation]
// })
}
var newSOId = objNewSo.save({
enableSourcing: false,
ignoreMandatoryFields: true
})
log.debug('newSOId', newSOId)
tuli
02/16/2023, 5:39 AMJunelle Sambat
02/16/2023, 6:42 AMNElliott
02/16/2023, 8:09 AMJordan Patterson
02/16/2023, 2:47 PMNetsuite Tragic
02/16/2023, 7:32 PMNetsuite Tragic
02/16/2023, 7:34 PM