SuiteScript 2.0 Dialog Prompt + On SaveRecord

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:

Native JS

jsprompt

Ext JS

extjsprompt

Note: This is a hack.

Here’s the code sample on how to achieve this (Works on both SS 1.0 and SS 2.0):


Additionally, thanks to this post from Abaci I was able to run this code right before the record is saved, which can be very useful to set the value of a field right before saving.

Here’s the code sample running on SaveRecord in SS 2.0:

I hope that was useful for you. Don’t forget to leave a comment if you have any questions!