Ken
12/13/2023, 9:51 PMasync function createOrder(orderBody:any){
const { tranid, entity, items } = orderBody;
const orderRec = record.create({
type: record.Type.SALES_ORDER,
isDynamic: true
});
orderRec.setValue({
fieldId: 'tranid',
value: tranid
});
orderRec.setValue({
fieldId: 'entity',
value: entity
});
items.forEach((item:any, index:number) => {
orderRec.setSublistValue({
sublistId: 'item',
fieldId: 'item',
line: index,
value: item.item
});
orderRec.setSublistValue({
sublistId: 'item',
fieldId: 'location',
line: index,
value: item.location
});
orderRec.setSublistValue({
sublistId: 'item',
fieldId: 'quantity',
line: index,
value: item.quantity
});
});
orderRec.save();
}
Is there a way for me to use external id to set a line item?erictgrubaugh
12/13/2023, 10:05 PMinternalid
Ken
12/13/2023, 10:06 PMerictgrubaugh
12/13/2023, 10:08 PMKen
12/13/2023, 10:08 PMKen
12/13/2023, 10:08 PMKen
12/13/2023, 10:08 PMerictgrubaugh
12/13/2023, 10:10 PM`SELECT id FROM item WHERE externalid IN (${externalids.join(',')})`
Ken
12/13/2023, 10:10 PMerictgrubaugh
12/13/2023, 10:12 PMexternalid
is a text field, so you need one filter per externalid, then OR
them all togetherKen
12/13/2023, 10:15 PMerictgrubaugh
12/13/2023, 10:15 PMKen
12/13/2023, 10:16 PMerictgrubaugh
12/13/2023, 10:18 PMKen
12/13/2023, 10:18 PMerictgrubaugh
12/13/2023, 10:22 PMKen
12/13/2023, 10:25 PMerictgrubaugh
12/13/2023, 10:29 PMerictgrubaugh
12/13/2023, 10:30 PMasync
in Restlets enough to know whether that will improve things; also consider orderRec.save.promise()
Ken
12/13/2023, 11:47 PMShawn Talbert
12/13/2023, 11:52 PM.save.promise()
is the caller doesn't know if the save was successful or not without building other async mechanisms to convey such.erictgrubaugh
12/13/2023, 11:53 PMcreateOrder
is async
?erictgrubaugh
12/13/2023, 11:54 PMShawn Talbert
12/13/2023, 11:56 PMerictgrubaugh
12/13/2023, 11:57 PMasync
so rarely, I'm surprised I caught it 🙂 but yes I'm still in agreement with you. You still (likely) need to close the loop with the originator of the request somehowShawn Talbert
12/13/2023, 11:58 PMasync
in server SuiteScript yeterictgrubaugh
12/14/2023, 2:29 AMPromise.all()
and it actually made things slow down. Not to say that will happen in all cases, but I suppose be waryNElliott
12/14/2023, 8:54 AM