How can I tell in a suitescript if a Purchase Orde...
# general
r
How can I tell in a suitescript if a Purchase Order is a drop ship or special order?
c
You can use field lookup
Copy code
let recordId = // Add your purchase order id here

let fieldLookUp = search.lookupFields({
    type: search.Type.PURCHASE_ORDER,
    id: recordId,
    columns: ['purchaseOrderTypeFieldId'] // Replace with the field id for PO type
});

let purchaseOrderType = fieldLookUp.purchaseOrderTypeFieldId;
we store our purchase order type using a custom field, so if I were using the field lookup, I'd do this:
Copy code
let recordId = // Add your purchase order id here

let fieldLookUp = search.lookupFields({
    type: search.Type.PURCHASE_ORDER,
    id: recordId,
    columns: ['custbody30'] // Replace with the field id for PO type
});

let purchaseOrderType = fieldLookUp.custbody30;
j
Look for something like applying link type
r
thanks but i found what i was looking for search.create({ type: "purchaseorder", filters: [ ['type', 'anyof', 'PurchOrd'], 'AND', ['mainline', 'is', 'F'], 'AND', ['internalid', 'anyof', purchaseOrderId], ], columns: [ search.createColumn({ name: 'appliedtolinktype' }) ], }) like @jm suggested