Hello, I have a question on how to show a confirma...
# suitescript
a
Hello, I have a question on how to show a confirmation message to the user in VIEW mode, after an action is performed by a Suitelet. Basically, a button is clicked by the user, the client script calls a suitelet. The suitelet does an operation and redirects back to the Sales Order record just updated. How can I show a success message on the Sales Order in VIEW mode based on the success of the operation?
a
Try to use addpageinitmessage if im not mistaken in the user event. You can put a param that will be checked so that if the param is of such value then the message will appear. And you can add the param once you call the redirect.torecord. Hope this will help it works coz i already used such an implementation
a
yes, I have tried that
but I want it to be conditional on a parameter that I set in the Suitelet
only when doing a certain operation I want to show this confirmation
otherwise it shows all the time
a
Then you should check the value of the paramter
Thats when you show the message
a
but how do I check the parameter value?
a
You get the parameter value from the context
a
on the user event script?
here is what I do on my suitelet
Copy code
soRecord.save();

// redirect
redirect.toRecord({
    type : record.Type.SALES_ORDER,
    id : soRecordId,
    isEditMode: false ,
    parameters: {'action_done':'SM_FILE_SENT'}
});
then, on the user event script, how can I get that parameter?
I want to show a message, only when that action_done is that
follow me?
a
Then get the parameter on beforeload context.request.parameters[‘action_done’]
a
really? let me try that
a
Then compare if the values is sm_file_sent
a
ok, let me try that
a
Ive been using that for awhile already
a
ok, let me see, I think I tried that… I must have done something wrong… trying now
a
Okay
a
it works beautifully!!!!
thank you so much!! I was fighting with this yesterday for a while
a
great.. its working fine now...
👍 1
a
yeah, you the man!
🙂 1