web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to make Alert stop for 15 seconds, once user save the dynamics 365 form, i have the below code and in that alert will be there for 3 seconds and without clicking on "Ok:" the page will navigate back

(0) ShareShare
ReportReport
Posted on by

i have written the below code  where once user save the dynamics 365 form, alert will pop up and  will be there for 3 seconds and without clicking on "Ok:" the page will navigate back

But i want it to stay for 15 seconds or either when users clicks on "OK" it should navigate back  

showFormNotification: function (executioncontext) {

var formContext = executioncontext.getFormContext();


var uniqueIdForInfo = "Shownotification101";

var displayTime = 15000;


var alertOptions = { height: 120, width: 260 };


var alertStrings = { confirmButtonLabel: "", text: "Your Assessment Request has been successfully raised !!", title: "Confirmation" };


if (formContext !== null) {

Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(


function () {


window.setTimeout( formContext.ui.clearFormNotification(uniqueIdForInfo),15000);


},
displayTime
);
}

Please let me know what code i need to add here

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at

    Hi,

    The clearFormNotification cannot be used to close an Alert dialog.

    You could consider to use the setFormNotification so that you can set a timeout for it.

    It will be something like:

    formContext.ui.setFormNotification("hello", "INFO", "hello");
    setTimeout(() => {
        formContext.ui.clearFormNotification("hello")
    }, 5000);

  • Community Member Profile Picture
    on at

    Hello  Nya

    I don't want to use notification,  like is it not possible such that when users clicks on Ok in alert it should navigate back?

    because here what is happening is within 3 seconds the form is navigating back even without user clicking on AK in alert pop up

  • Verified answer
    Nya Profile Picture
    29,060 on at

    Hi,

    I understand your request but based on my searching there is no way to close the dialog with JavaScript only. (My idea was to trigger the shutdown via the Enter key but it was not possible.)

    Here are my references:

    dialog - Javascript close alert box - Stack Overflow

    javascript - How can I auto hide alert box after it showing it? - Stack Overflow

    javascript - How to "auto close" Alert boxes - Stack Overflow

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 74

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans