Discussions
NSC | Check Duplicate Order numbers
In some cases, a user may need to warn users that there are potential duplicate records. To achieve this, a user would like an error message to be displayed once the user creates an Sales Order with an existing Order Number already used with the same customer. This is achievable through Scripts
Execute a Search:
var searchResult = nlapiSearchRecord('salesorder', null, filters, columns);
if(searchResult != null)
{
for(var x=0; x < searchResult.length; x++)
{
var customerID = searchResult[x].getValue('entity');
nlapiLogExecution('DEBUG','Customer ID',"Customer ID: "+ customerID)
var customerPurchOrd = searchResult[x].getValue('otherrefnum')
nlapiLogExecution('DEBUG','Sales Order Number',"Sales Order Number: "+ customerPurchOrd)
