I am doing a search on Purchase orders and trying ...
# suitescript
s
I am doing a search on Purchase orders and trying to get the vendor id and name. but the two join columns are pulling nothing. Can anyone shed some light regarding the last 2 columns?
var purchaseorderSearchObj = search.create({
type: "purchaseorder",
filters:
[
["type","anyof","PurchOrd"],
"AND",
["mainline","is","T"]
],
columns:
[
search.createColumn({name: "datecreated", sort: search.Sort.DESC, label: "Date Created"}),
search.createColumn({name: "tranid", label: "Document Number"}),
search.createColumn({name: "entity", label: "Name"}),
search.createColumn({name: "statusref", label: "Status"}),
search.createColumn({name: "amount", label: "Amount"}),
search.createColumn({name: "createdfrom", label: "Created From"}),
search.createColumn({name: "lastmodifieddate"}),
search.createColumn({name: "entityid", join: "vendor", label: "ID"}),
search.createColumn({name: "altname", join: "vendor", label: "Name"})
]
});
r
Looks correct. Perhaps you are sending invalid JSON to
SearchResult.getValue()
.
result.getValue({name: 'entityid', join: 'vendor'})
you need the join
s
BINGO! I did not know I needed the join on the result. Thank you SO much!
👍 1
l
there's a tool that can take a saved search in UI into code.
s
That is what I use. But it only shows the search and not the assignment of the retrieved values to variables.
l
i see.
s
...but it is a very handy add-on
1
y
Seems joined is incorrect. Make changes like as below and try result.getValue({name: 'altname', join: 'entity'})
r
@yagyakumarnag searches use the transaction table of the records browser, not the field listing from the PO table. notice how the PO table does not have joins, and directs you to the Transaction table for searches.