Yes the appliedtotransaction can return item recei...
# suitescript
j
Yes the appliedtotransaction can return item receipts as well so you'd want to specify the applied to transaction type in your criteria to only get Purchase orders.
f
So something like this:
Copy code
const poSearch = search.create({
                type: search.Type.TRANSACTION,
                filters: [
                    {
                        name: "internalid",
                        operator: <http://search.Operator.IS|search.Operator.IS>,
                        values: [searchResult.values["internalid"]],
                    },
                    {
                        name: "type",
                        join: "appliedtotransaction",
                        operator: <http://search.Operator.IS|search.Operator.IS>,
                        values: ["PurchOrd"]
                    },
                ],
                columns: [
                    {
                        name: "internalid",
                        join: "appliedtotransaction"
                    },
                    {
                        name: "tranid",
                        join: "appliedtotransaction"
                    },
                    {
                        name: "trandate",
                        join: "appliedtotransaction"
                    },
                    {
                        name: "total",
                        join: "appliedtotransaction"
                    },
                    {
                        name: "currency",
                        join: "appliedtotransaction"
                    },
                    {
                        name: "memo",
                        join: "appliedtotransaction"
                    }
                ],
            });
should work?