Javascript 如何使用自定义按钮发布到Suitelet?

Javascript 如何使用自定义按钮发布到Suitelet?,javascript,json,url,netsuite,suitescript2.0,Javascript,Json,Url,Netsuite,Suitescript2.0,基本上我有一个Suitelet,有两个按钮: 1添加提交按钮 1添加按钮 我希望add按钮与它的数据一起重定向到POST上下文 到目前为止,我已经在客户端脚本上使用了resolveURL和https.post.promise。我可以使用window.open重定向到URL,但似乎无法从post方法传递数据 以下是我当前的脚本: SUITELET: var btnPrint = formGet.addButton({ id:'custpage_print_button', labe

基本上我有一个Suitelet,有两个按钮:

1添加提交按钮 1添加按钮

我希望add按钮与它的数据一起重定向到POST上下文

到目前为止,我已经在客户端脚本上使用了resolveURL和https.post.promise。我可以使用window.open重定向到URL,但似乎无法从post方法传递数据

以下是我当前的脚本:

SUITELET:

var btnPrint = formGet.addButton({
    id:'custpage_print_button',
    label: 'Email To Customers',
    functionName:'emailButton('+scriptId +','+deploymentId+')'
});
客户:

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');
}

https.post.promise是一种承诺。您需要对此做些什么,因为它不是
ServerResponse

https.post.promise({
        url: suiteletURL, 
        headers:header,
        body:postData
    }).then(function(response){
        if(response && response.body){
            alert('response: ' + response.body.toString());
        }
    }).catch(function(reason){
    });;

您可以尝试从客户端脚本中单击“提交”按钮