NetSuite / Suitescript - Why does this Validate Field script introduce an infinite loop?

My script goes into an endless loop and I have no idea why. I run this on the validate field, and I discourage the change in the field if there is another vendor account with the same reference number, forcing the user to change the "reference number" to be unique. Here is my code:

function validateField(type, name) {

    if (uniqueReferenceNum(type, name) === false) {

        return false;
    }

return true;
}


function uniqueReferenceNum(type, name) {

if (name !== 'tranid') {

    return true;
}

var tranID = nlapiGetFieldValue('tranid');
var vendor = nlapiGetFieldValue('entity');
var vendorName = nlapiGetFieldText('entity');

var filters = new Array();
var columns = new Array();

filters[0] = new nlobjSearchFilter('entity', null, 'is', vendor);
filters[1] = new nlobjSearchFilter('tranid', null, 'is', tranID);
filters[2] = new nlobjSearchFilter('mainline', null, 'is', 'T');

columns[0] = new nlobjSearchColumn('internalid');

results = nlapiSearchRecord('vendorbill', null, filters, columns);

if (!results) {

    return true;

}


alert("There is already a vendor bill with reference # " + tranID + " for " + vendorName + ". Please verify and change the reference number before continuing.");
return false;
}

      

+3
validation field netsuite suitescript


source to share


No one has answered this question yet

See similar questions:

0
validateField client event not working as expected in Chrome

or similar:

1338
Why does Java have transient fields?
five
On which javascript version is NetSuite currently running SuiteScripts?
1
NetSuite / Suitescript - Field focus on page load
1
Disable NetSuite SuiteScript 2.0 box based on checkbox
0
How do I set the layout for a field added via a list of numbers in NetSuite?
0
NetSuite SuiteScript client-side fault tolerance
0
SSS_INVALID_SRCH_FILTER_JOIN when using a filter expression in a merged custom field
0
List of Suitescript 2 numbers list.addRows from search results that have a connection
0
How can I get itemfulfillment search without repeating / duplicating
-1
Netsuite custom field does not display data in search results



All Articles
Loading...
X
Show
Funny
Dev
Pics