SuiteScript 2.0 Dialog Prompt + On SaveRecord
One of the new modules in Suitescript 2.0 is the “N/ui/dialog” module but unfortunately it doesn’t include a prompt method. I did some digging and found that the dialog module uses Sencha Ext JS. Since Ext JS doesn’t require the dialog module it can run on both SS 1.0 and 2.0! Here’s how they look like side by side: Here’s the code sample on how to achieve this (Works on both SS 1.0 and SS 2.0):
1 2 3 4 5 6 7 8 |
function showPrompt(){ Ext.Msg.prompt("My Prompt Title", "Please enter your text:", handlePromptResult, this); function handlePromptResult(buttonClicked, text) { if (buttonClicked !== 'ok') { return; } console.log("You entered: " + text); } } |
Additionally, thanks to this…