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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Getting error when adding preventDefault() to "Send" Email button

(0) ShareShare
ReportReport
Posted on by

Hi,

Trying to add a confirm prompt when user click on Send email button to perform some checking, so in my script i do cancel the save operation & execute my validation logic.

At the same time i will get below error message & not sure how to get rid of it. but the same logic if i put to Save or Save & close its working fine.

pastedimage1631866386699v1.png

My script

emailOnSave = function(executionContext) {
    var eventArgs = executionContext.getEventArgs();

    if (eventArgs.getSaveMode() == 7) {
        eventArgs.preventDefault();
        var confirmStrings = {
            text: "xxx?",
            title: "CONFIRM"
        };
        var confirmOptions = {
            height: 200,
            width: 450
        };
        Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
            function(success) {
                if (success.confirmed) {
                    // custom logic
                }
            });
    }
}

Anyone?

I have the same question (0)
  • James Hoes Profile Picture
    5 on at

    You cannot add an action to the body of an HTML document. You can only add actions inside a script element or another type of processing instruction. You should also check that your action is set to execute on load by looking at the event attribute’s value and you should also check domyhomework123 to get your assignments written on time. If it is not, you should make sure that it is set properly in the Action Editor.

  • cosper1 Profile Picture
    5 on at

    The staff's professionalism and friendliness

    www.bestcustomwriting.com/buy-research-paper

    Professionalism and warmth are also crucial characteristics. You must examine the discount budget, friendliness, and after-sales services before making your decision. A checklist like this helps ensure that you're hiring a reputable group of professionals. The additional circumstances to which you should pay attention are good, with well-trained specialists playing a crucial role.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hello,

    Try below code -

    //Need to use the following code.  This will suppress the dialog box

         formContext.data.entity.addOnSave(function () {

         });

    community.dynamics.com/.../1021229

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans