Clear addInfoMessage after 5 seconds

magnushedlu
Tera Guru

Hi,

 

I would like to clear the info message that shows on Incidents when they are created from an Universal Request after like 5 seconds as the message actually hides action buttons in the SOW.

I have located the business rule that controls the message but I don’t understand how I can make it clear after a few seconds. Is it possible to achieve by updating the script?

 

Alternatively if there are other good ways to inform the users about this type of message. 

4 REPLIES 4

Runjay Patel
Giga Sage

Hi @magnushedlu ,

 

try below code.

// Display the info message
g_form.addInfoMessage('This is an info message');

// Clear the info message after 5 seconds
setTimeout(function() {
g_form.clearMessages();
}, 5000); // 5000 milliseconds = 5 seconds

Accept the solution if it helped.

Juhi Poddar
Kilo Patron

Hello @magnushedlu 

It is not possible to directly hide a message from the form after 5 seconds using a server-side business rule. However, the function g_form.clearMessages() can be used to clear messages, but it works only on the client side.

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar

 

magnushedlu
Tera Guru

Ok, so as the business rule (server side) is controlling the addinfomessage in this case I guess that I can't just add the clearmessage to the script as it only works on client side script?

Hello @magnushedlu 

Yes, you are absolutely right!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps others find the solution more easily and supports the community!"

 

Thank You
Juhi Poddar