How to hide alert message pop up based on the duration or click

ChanchalG
Tera Expert

Hi,

I have a requirement where they want to hide the alert message automatically after some duration or once cursor get click anywhere else in screen.

I want to check if there is any way to decrease/ Increase alert message popup duration and if we can configure something on click.

Thanks,
Chanchal

ChanchalG_0-1742392379704.png

 

1 ACCEPTED SOLUTION

Hello,

I have raised a case with ServiceNow. and its seems this system property (glide.service-portal.notification_timeout.seconds) should work but if the UI accessibility user preference is enabled this system property will not work.

so if you want a time out accessibility user preference should be disabled.

View solution in original post

10 REPLIES 10

Hello @ChanchalG 

 

Now I got your requirement so these are the messages that appear for mandatory field errors on catalog form in service portal. 

 

So you can go with the same client script that I shared above , just some tweaks will be there. 

 

Please try this - 

(function executeRule() {

    function hideMandatoryMessages() {

        setTimeout(function () {

            $(".sp-mandatory").fadeOut("slow"); // Hide mandatory field messages

        }, 5000); // Adjust the timer (5000ms = 5 seconds)

    }

 

    // Run the function when the form loads

    hideMandatoryMessages();

 

    // Also, hide the message when user clicks anywhere

    $(document).on("click", function () {

        $(".sp-mandatory").fadeOut("slow");

 

  });

 

})();

 

This can be in On Submit client script. Because I am supposing rhe errors will come only then. And that's the max I think we can customize these things in service portal or any portal. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Hello @ChanchalG 

 

Please ignore the previous script thats a recursive approach. 

 

Please use this one - 

 

(function executeRule() {

    function hideMandatoryMessages() {

        setTimeout(function () {

            $(".sp-mandatory").fadeOut("slow"); // Hide mandatory field messages

        }, 5000); // Adjust the timer (5000ms = 5 seconds)

    }

 

    // Run the function when the form loads

    hideMandatoryMessages();

 

    // Also, hide the message when user clicks anywhere

    $(document).on("click", function () {

        $(".sp-mandatory").fadeOut("slow");

 

  });

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

 

})();

I have created a snow ticket to check if there is ootb way to solve this. If not i will try the custom solution. Thank you.

Hello @ChanchalG 

 

Kindly mark my answer as helpful and/or accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Hello,

I have raised a case with ServiceNow. and its seems this system property (glide.service-portal.notification_timeout.seconds) should work but if the UI accessibility user preference is enabled this system property will not work.

so if you want a time out accessibility user preference should be disabled.