gs.addInfoMessage after submit

brendanwilson84
Kilo Guru

Hi Guys

Quite new to scripting, however, I have a ui action to submit the request and would like a message to appear after its submitted and when they are redirected back to say the list. I have the below which shows.

However, I have a business rule that prevents the user from attaching before submit. If they try submit without attachment, then the 'request submitted " message appears along with the invalid insert because of no attachment on the form.  

find_real_file.png

I like the message to only appear after submit on appear on the list like this

find_real_file.png

Thank you

3 REPLIES 3

Chuck Tomasi
Tera Patron

Hi Brendan,



Try putting the gs.addInfoMessage() after the current.update().


Hi Chuck,



Thanks for the reply.



I am still getting the message on the form if I don't attach


find_real_file.png


Any chance you can copy the "attachment check" logic to your UI action and test it there before doing the current.update()? Then you could do an if/else check. Something like this:



// Pseudo code


if (attachmentsNotFound) {


        gs.addErrorMessage('You need to attach your template before submitting');


} else {


        gs.addInfoMessage('Your request has been submitted successfully.');


        current.update();


}


action.setRedirectURL(current);