Last active
July 15, 2019 16:23
-
-
Save cafeasp/e0e0456ad261b67175d839861de3f44c to your computer and use it in GitHub Desktop.
NetSuite SuiteScript 2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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