Basically I have a Suitelet that 2 buttons:
1 addSubmitButton 1 addButton
I would like the add button to redirect to a POST context along with its data.
So far i've used resolveURL and https.post.promise on a Client Script. I can redirect to the URL using window.open, but I can't seem to pass the data as well from the post method.
Here's my current script:
SUITELET:
var btnPrint = formGet.addButton({
id:'custpage_print_button',
label: 'Email To Customers',
functionName:'emailButton('+scriptId +','+deploymentId+')'
});
CLIENT:
function emailButton(suiteletScriptId,suiteletDeploymentId){
var suiteletURL = url.resolveScript({
scriptId : suiteletScriptId,
deploymentId : suiteletDeploymentId,
});
var header=[];
header['Content-Type']='application/json';
var postData={'hello':'hi'};
var response=https.post.promise({
url: suiteletURL,
headers:header,
body:postData
});
alert('response: ' + response.body.toString());
window.open('"+suiteletURL+"','_blank');
}