i have created a suitelet. I want to refresh my list when a field is changed on the suitelet.
below is the code for the suitelet:
function suitelet(request, response){
if ( request.getMethod() == 'GET' )
{
var form = nlapiCreateForm('First Form');
form.setTitle('My Test Suitelet');
form.addField('email','email','Email');
form.addField('employee','select','Employee','employee');
form.setScript('customscript311');
var contacts = form.addSubList('custpage_contacts', 'list', 'Custom Contacts', 'general');
contacts.addField('custpage_checkbox', 'checkbox');
contacts.addField('email', 'email', 'Email');
contacts.addField('firstname','text','Name');
if(nlapiGetFieldValue('employee')== null || nlapiGetFieldValue('employee')==''){
var columns = new Array;
columns[0]= new nlobjSearchColumn('email');
columns[0]= new nlobjSearchColumn('firstname');
var contactdata = nlapiSearchRecord('employee', null,null,columns);
}
else{
var Filter = new nlobjSearchFilter('internalid', null, 'is',nlapiGetFieldValue('employee'));
var columns = new Array;
columns[0]= new nlobjSearchColumn('email');
columns[0]= new nlobjSearchColumn('firstname');
var contactdata = nlapiSearchRecord('employee', null,Filter,columns);
}
// display the search results on the Custom Contact sublist
contacts.setLineItemValues(contactdata);
//var sublist = contacts.getLineItemCount();
//var count = sublist.getLineItemCount('')
//nlapiLogExecution('DEBUG','Hi',sublist);
form.addSubmitButton('Submit');
response.writePage(form);
}
As soon as the employee is selected in Employee field i want to refresh my list with only the details of the employee which is selected.
on my form.setScript() i tried redirecting it to the same suitelet with the updated data but it pop up that u havnt submitted the record do you wish to continue.
:h_a_w: