Add Alert/InfoMessage and redirect

Ben F_
Giga Contributor

Hello All, 

 

I am trying to create a script that will give the user a notification onSubmit that they submitted the form correctly and redirect them back to the list view. Simply put, user fills out the form. Clicks submit. They are notified of successful submission and redirected. 

Also, what would be best practice? (Business Rule, Client Script, etc.) 

 

Thanks, 

Ben 

1 ACCEPTED SOLUTION

Rajat Gupta6
Tera Guru

If you want the message to stay on screen even after redirecting the user to list view and user needs to remove the message manually, use After Insert BR and in the Actions tab enter your message.

If you want the message to disappear before redirecting to list view, use OnSubmit client script and use g_form.addInfoMessage("Incident submitted successfully.")

Mark it correct if it resolves your problem.

 

View solution in original post

4 REPLIES 4

asifnoor
Kilo Patron

Hi Ben,

I suggest you do this in Business Rule bcoz a business rule can be triggered either on before/after DB operation, which would mean that all client and server-side validations are completed and data is ready to enter the table.

So you can write after insert BR and in the script, you can call

gs.addInfoMessage("Your form is submitted successfully");

Kindly mark the comment as a correct answer and also helpful if it answers your question.

Mike Patel
Tera Sage

If you want to do it on specific catalog item you can create onSubmit client script with something like below

function onSubmit() {
	g_form.addInfoMessage("Request has been submitted. Please wait....");
	top.window.setTimeout(fun2, 50000);
	
	function fun2() {
		top.window.location = "https://google.com";
	}
}

Rajat Gupta6
Tera Guru

If you want the message to stay on screen even after redirecting the user to list view and user needs to remove the message manually, use After Insert BR and in the Actions tab enter your message.

If you want the message to disappear before redirecting to list view, use OnSubmit client script and use g_form.addInfoMessage("Incident submitted successfully.")

Mark it correct if it resolves your problem.

 

Rahul Kathuria
Tera Expert

HI Ben,

Do it using an after insert BR. Try using business Rules and Workflow as much as possible.  Avoid using client scripts, except for Catalog Client Scripts (which are unavoidable).  This is due to performance reasons and browser issues that client scripts can introduce.

 

 AFTER business rule(with update checkbox set to true) and under action tab set "Add Message" field to true, Set the message in the message box field.

 

Thanks

Rahul Kathuria