The “Billing Transaction” field in saved searches can be used to link transactions to their corresponding invoices. This field contains the internal ID of the invoice that is associated with a particular transaction.
For example, in a saved search for sales orders, the “Billing Transaction” field can be used to retrieve details of the corresponding invoice for each sales order. This can be done by adding the “internalid” field of the invoice to the search columns and linking it to the “Billing Transaction” field using a join. This will allow you to retrieve all relevant details of the invoice in the same search as the sales order.
var transactionSearchObj = search.create({
type: "transaction",
filters: [
["mainline","is","T"],
"AND",
["type","anyof","SalesOrd"],
"AND",
["billingtransaction.type","anyof","CustInvc"]
],
columns: [
search.createColumn({
name: "tranid",
join: "billingtransaction",
summary: "GROUP",
label: "Invoice Number"
})
})
In this search, we are filtering for Sales Orders (type is SalesOrd) with invoices associated with them (billingtransaction.type is CustInvc). The columns in the search can include details from both the Sales Order and the associated invoice. In the same search, we can retrieve columns from both sales orders and invoices.