I am trying to load and email document when a button is clicked.Iam getting 'id' missing error. I am sure that I am not connecting them properly. Can anyone please suggest where am I doing wrong?
Suitelet:
function Email_SIForm(request, response)
{
var SOid = nlapiGetRecordId();
nlapiLogExecution('DEBUG', 'SOid', SOid);
var sorecrd = nlapiLoadRecord('salesorder',SOid);
var SI = sorecrd.getFieldValue('custbody_dwr_salesorder_si' );
nlapiLogExecution('DEBUG', 'SI', SI);
var file = nlapiLoadFile(SI);
nlapiLogExecution('DEBUG', 'file', file);
var newEmail = nlapiSendEmail(3, 'sru@test.com.au', 'Sample email and attachment', 'Please see the attached file', null, null, null, file);
}
UserEvent:
function beforeload_MojEmailFile(type, form, request){
if (type == "view") {
var urlStr = nlapiResolveURL("SUITELET",'customscript55', customdeploy1');
var jsStr = "document.location='" + urlStr + "';";
form.addButton('custpage_button','My Button',jsStr);
}
}