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...
Suggested Answer

Javascript alert function running twice in my script

(0) ShareShare
ReportReport
Posted on by 836

It seems my JS is running twice when I have called it only once that is on save, I have used alert dialog box and this alert dialog box comes twice so i am not able to understand why this problem is coming can anyone help below is the code that i have used.
context.getEventArgs().preventDefault();
var alertStrings = { confirmButtonLabel: "Yes", text: "Please complete the Technical Evaluation First and Mark 'Technical Evaluation Completed' field as Yes.", title: "Booking Alert: ERROR" };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function (success) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);

I have the same question (0)
  • LB-04061101-0 Profile Picture
    on at

    Hello Ravi,

    I would suggest to add a debugger statement in the code and use the Developer tool create a breakpoint to debug. More details on docs.microsoft.com/.../debugger

    Luis

  • Ravi Fulani Profile Picture
    836 on at

    Hi  @Luis Boal

    I did try that and it ran twice so I am lil bit not able to understand the reason.

  • Suggested answer
    PabloCRP Profile Picture
    1,088 on at

    "The form saves every 30 seconds so it can cause plug-ins, workflows, or JavaScript to trigger when you may not want them to"

    pastedimage1606333814895v1.png

    it raises twice because at the time you are debugging the autosave already happend.

    So turn it off.

    more info...

    1- MSDocs

    2- Auto Save Form

    regards.

    Don't forget to mark as an answer if it was helpfull

  • Ravi Fulani Profile Picture
    836 on at

    Auto save is already No in my system, That is the reason I am confused that such simple code which shows only an alert why it is running twice

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
#ManoVerse Profile Picture

#ManoVerse 93

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 62 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans