Discussions
Working with custom records
Hi,
I have a script that does a search for a custom record based on a value of a custom field after a customer record has been created.
It used this value to lookup a custom record to see if it already exists.
Here is the code:
function CheckIfTHisCardNumberExists()
{
 var currentRecord;
 currentRecord = nlapiGetNewRecord();
 var enteredcardno = currentRecord.getFieldValue('custrecord_linked_card_no');
 var searchresults = nlapiSearchRecord('customrecord17', null, null, null);
 var totalsize = searchresults.length;
 for (var i = 0; i < totalsize; i ++)
 {
  
  var searchresult = searchresults[i];
  var curcardnum   =  searchresult.getValue('custrecord_mship_mem_2');
alert("curcardnum is " + custrecord_mship_mem_2);
  if (curcardnum == enteredcardno)