I have a suitelet similar to:
How to add checkbox in a list (serverWidget.List) in Suitelet
what would the client script look like for something like this? I'm new to scripting so still getting my head around it. Basically what I would like to do is, if there are checks on the sublist in the suitelet, when you click submit, a couple of fields on the checked records get updated. I have the following in my client script, it seems as though the client script is not able to source the internalID of the 'checked' record from the suitelet (maybe missing something to do with context?):
function SaveRecord() {
var isChecked = "F"
var lineCount = nlapiGetLineItemCount('custpage_sublist_id')
nlapiLogExecution('DEBUG', 'Line Count', lineCount);
if (lineCount>0){
for(var line=1; line<=lineCount; line++)
isChecked =
nlapiGetLineItemValue('custpage_sublist_id','custfield_selected',line);
var siinternalid = nlapiGetLineItemValue('custpage_sublist_id',
'internalId',line);
nlapiLogExecution('DEBUG', 'Internal ID', siinternalid);
if (isChecked =="T") {
var record = nlapiLoadRecord('VendorBill',siinternalid);
record.setFieldValue('FIELD1', 'T');
record.setFieldValue('FIELD2','F')
nlapiSubmitRecord(record);
}
}
return true;
}
Thanks.
I solved the issue by removing the client script altogether and adding a POST (else) element to the suitelet to handle the submit element of the suitelet. If anyone wants to see let me know and I can post up.