I want to show a confirmation message after record...
# suitescript
a
I want to show a confirmation message after record has been saved using message module, what entry point should be used?
w
I've done the following before: 1. store the message in beforesubmit in a field on the record. 2. In beforeLoad use Form.addPageInitMessage(options) to display(and maybe clear) that message on next load (ie after the save is complete). Or just skip 1. and perhaps have some logic that knows when to display the message.
a
@Watz what kind of logic?
w
That depends on your use-case
a
And is this the only way?
There is no way to show the confirmation message after save or submit the record easier?
w
is it something like the standard confirmation message that you want to replicate?
message has been deleted
a
Yes
Like standard confirmation message
w
1. set a checkbox on beforesubmit "custbody_saved" 2. display a message on beforeload as I said earlier 3. record.submitFields to update the checkbox in beforeload. So that the message isn't shown every time you enter the record. I haven't tested the last part, might be some conflict in updating the record that you're loading. I don't know if it is possible to access what the previous action in the webbrowser was. Maybe that would be better. What would be easy to you?
a
Just somehow use message.show() in client script
w
yeah, you could do that as well. But as the record probably is in view-mode after you have saved it, you'd need to attach that script in beforeload or embed the code in a inlineHTML-field https://netsuite.custhelp.com/app/answers/detail/a_id/83824/kw/n%2Fui%2Fserverwidget%2Fmessage
a
How do we know if before this view mode
User was creating this record or just editing
Or this has been created last month
w
I don't think you know that at all. You could perhaps draw some conclusions using the datecreated and lastmodified fields.
a
That check box and updating the value for that before load is a problem
b
this is probably a reasonable place to use the runtime.Session
👍 1
w
@battk, is the sessionObject available both in beforesubmit/aftersubmit and beforeload?
b
yes
w
I remember some limitation to it. Was it that you couldn't access it in clientscripts?
b
yes
💯 1
w
ok, but for @Ali, this would work well then.
a
Thanks all