Need a quick and efficient way to extract Purchase Order details for audits, reporting, or troubleshooting purposes? This SuiteScript offers a straightforward solution by pulling essential information like transaction ID, transaction date, vendor details, status, and total amount—directly from your system without the need for navigating saved searches.
By leveraging the N/search module, the script builds a clear and concise summary of Purchase Orders, focusing only on the mainline (header-level) data. It’s a practical tool for administrators and developers who want a fast, code-driven method to retrieve and review PO data with minimal effort.
Sample SuiteScript: Retrieve Purchase Order Data
require(['N/search'],function(search){
var poSearch = search.create({
type: search.Type.TRANSACTION,
filters: [['type',search.Operator.IS,'PurchOrd']
,'and',
[ 'mainline', search.Operator.IS, 'T']],
columns:[{
name:'tranid'
},
{
name:'trandate'
},
{
name:'entity'
},
{
name:'otherrefnum'
},
{
name:'status'
},
{
name:'total'
}],
title: 'Purchase Orders'
})
var resultSet=poSearch.run()
resultSet.each(function(result){
console.log('-----------')
console.log('Transaction ID : ' + result.getValue({name:'tranid'}))
console.log('Transaction Date : ' + result.getValue({name:'trandate'}))
console.log('Vendor ID : ' + result.getText({name:'otherrefnum'}))
console.log('Vendor Name : ' + result.getText({name:'entity'}))
console.log('Status : ' + result.getValue({name:'status'}))
console.log('Total : ' + result.getValue({name:'total'}))
console.log('-----------')
return true
})
})
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
To know more about deploying SuiteScript, check these New to NetSuite Articles.
Do you have another way on how to automate your records using SuiteScript? Feel free to share them here!