Reputation: 205
I am struggling to find a way to add a button to a Suitelet that calls another function in the same suitelet. I have tried many things but I can not get anything to work. I also tried to create a client script and call the client script but the issue with that solution is I need to call another function in the Suitelet from the client script.
function Image(request, response){
var form = nlapiCreateForm("Today's Checks", true);
function next(count){
//code here
showImage(imageId);//call to another function
}
form.addButton('custpage_next','Next',"next();");
response.writePage(form);
showImage(id){
//more code . . .
}
}
Upvotes: 0
Views: 3707
Reputation: 15367
The suitelet runs server side. You need to enable client side code. Put the code you need into another file and use it to create a client script. Give it a useful id when you create it. You don't need to deploy the script. Then
form.setScript('customscript_clientscriptid');
Then you can use the functions from that file in your button code.
Upvotes: 4