Skip to content

Instantly share code, notes, and snippets.

@cafeasp
Last active July 15, 2019 16:23
Show Gist options
  • Save cafeasp/e0e0456ad261b67175d839861de3f44c to your computer and use it in GitHub Desktop.
Save cafeasp/e0e0456ad261b67175d839861de3f44c to your computer and use it in GitHub Desktop.
NetSuite SuiteScript 2.0
function IsNewOrder(orderId) {
var s = search.create({
type: search.Type.SALES_ORDER,
filters: [
['mainline', 'is', 'T'], 'and',
['trandate', 'onorafter', '04/01/2019'], 'and',
['otherrefnum', 'equalto', orderId]
],
columns: ['otherrefnum']
}).run().getRange({
start: 0,
end: 10
});//should only be one
if (s.length > 0) {
var poNumber = s[0].getValue({
name: 'otherrefnum'//unique value
});
if (poNumber == orderId) {
return false;
} else {
return true;
}
} else {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment