Skip to main content

Notifications

Dynamics 365 general forum

openConfirmDialog with parameters to callback functions

Posted on by 2

Hi,

We have a custom control that allows to open the defaukt form of the entity displayed in the form.

dataController.openEntityForm = function ($event, item, row) {
            var entityFormOptions = {};
            entityFormOptions["entityName"] = item.LogicalName;
            entityFormOptions["entityId"] = item.Id;
	    Xrm.Navigation.openForm(entityFormOptions);
}


Now, we need to ask first a question before the redirection to the entity form.

Only on a positive answer, we should redirect.

I looked into the openConfirmDialog, but as it is async in V9.0, I need to pass parameters to it.

Anyone who can help me with this?

Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
            function(success) { 
                if (success.confirmed) {
                    //redirect : how to get name and id?
                }
                else {
                    //do nothing
                }
            },
            function(fail) { 
            //TODO TO DO : check if we can display an error
            }
     );


Thanks

Birgit

  • Birgit RD Profile Picture
    Birgit RD 2 on at
    RE: openConfirmDialog with parameters to callback functions

    Hi,

    I defined the entityFormOptions before the openConfirmDialog, en tried to pass it as a parameter.

    I solved it slightly different, but it is clear to me how to use it correctly.

    Thanks for feedback

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: openConfirmDialog with parameters to callback functions

    Hello Birgit,

    What issues do you experience? It should work fine like:

    dataController.openEntityForm = function ($event, item, row) {

    Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(

               function(success) {

                   if (success.confirmed) {

              var entityFormOptions = {};

               entityFormOptions["entityName"] = item.LogicalName;

               entityFormOptions["entityId"] = item.Id;

       Xrm.Navigation.openForm(entityFormOptions);

                   }

                   else {

                       //do nothing

                   }

               },

               function(fail) {

               //TODO TO DO : check if we can display an error

               }

        );

    }

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans