我想在suitelet 2.0中添加一個自定義按鈕,並且我想要在單擊該按鈕時執行一個操作。在suitelet 2.0中的form.addButton上的操作
我想這樣做同樣是這樣
form.addButton({
id : 'reset',
label : 'Reset',
functionName: 'setButton'
});
但它不會做任何動作。
我想在suitelet 2.0中添加一個自定義按鈕,並且我想要在單擊該按鈕時執行一個操作。在suitelet 2.0中的form.addButton上的操作
我想這樣做同樣是這樣
form.addButton({
id : 'reset',
label : 'Reset',
functionName: 'setButton'
});
但它不會做任何動作。
您需要包括在clientscript文件中的函數,然後用clientscript附加到形式:
form.clientScriptFileId = 32;
如果你實際上是在尋找一個復位按鈕,嘗試內置:
form.addResetButton({
label : 'Reset'
});
否則,如果你需要定製
form.addButton({
id : 'reset',
label : 'Reset',
functionName: 'setButton'
});
form.clientScriptModulePath = 'SuiteScripts/setButton-clientscript.js';
With setButton-clientscript.js
contains your function definition ala:
define(['N/currentRecord'],
function(currentRecord) {
function setButton() {
//your code here
//example: location.reload();
}
return {
setButton: setButton
};
});