creating my first suitelet - add button approve an...
# suitescript
m
creating my first suitelet - add button approve and reject: form.addSubmitButton({ id: 'approvebuttonid', label: 'Approve' }); form.addButton({ id: 'rejectbuttonid', label: 'Reject' }); approve button is submitting to NetSuite based on sublist lines ticked and working as expected however when the same I'm trying for the reject button, nothing seems to happen.. if I change the reject button to addSubmitButton, both buttons appear as Reject whilst the approve comes up on the form as a dropdown arrow?
additional bit of the code: for (var i = 0; i < lineCount; i++) { var isSelected = serverRequest.getSublistValue({ group: 'custpage_sublistid', name: 'custpage_checkbox', line: i }); if (isSelected === 'T') { var tranInternalID = serverRequest.getSublistValue({ group: 'custpage_sublistid', name: 'custpage_internalid', line: i }); var isRejectButtonClicked = serverRequest.getSublistValue({ group:'custpage_sublistid', name: 'rejectbuttonid', line: i }); isRejectButtonClicked = isRejectButtonClicked === 'T'; if (isRejectButtonClicked) { record.submitFields({ type: record.Type.SALES_ORDER, id: tranInternalID, values: { custbody_test: 'Rejected' } }); } else { record.submitFields({ type: record.Type.SALES_ORDER, id: tranInternalID, values: { custbody_approved: 'T' } }); }
b
suitelet form are expected to only have 1 submit button
you have to work extra hard to get 2 buttons that submit the form
write your logic with that in mind
use the functionName to make your reject button actually do something