Hi all,
I need a script that looks at a search update a date field on the customer record. I haven't written any SuiteScripts in over 3 years and needless to say I'm drawing a blank on how to do this. I can't get the SuiteScript IDE to install, and the SuiteScript Debugger doesn't tell me anything as to what I need to correct. I was planning on having this run as a scheduled script that runs every hour and updates any applicable record that does not have a value in the field I am trying to update.
I have a saved search that contains a formula field which supplies the date I need to update on the customer record.
function Begin()
{
var columns = new Array();
columns[0] = new nlobjSearchColumn("entity");
columns[1] = new nlobjSearchColumn("number");
var results = nlapiSearchRecord('customer', 'customsearch_custtransdate', filters, columns);
nlapiLogExecution('DEBUG', 'Records to process: ' + (results == null ? "0" : results.length));
for (var i = 0; results != null && i < results.length; i++)
{
var internalID = results[i].getId();
var customerID = results[i].getValue('entity');
var customerName = results[i].getValue('number');
nlapiLogExecution('DEBUG', 'Record ' + (i+1) + ': ' + customerID + ' - ' + customerName,
'CustomerID: {' + customerID + '}<br>CustomerName: {' + customerName + '};
nlapiSetFieldValue('entity', number, 'custentity_esttransdate', '{firstorderdate}+30');
}
}
Can someone please help me?