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 CRM (Archived)

Can't cancel from grid form after closing the form grid

(0) ShareShare
ReportReport
Posted on by 1,532

Hi

I have a form that contains a grid.   The user clicks an item in the grid and item opens a form.  Everything is working great.

When the user enters data on a field a change event is trigger.  The event does the following displays a Dialog,  call Action Process and closes the form using Xrm.Page.ui.close().   The action process is updating a field on the entity.  The logic is working great.

The problem that I am having is when the grid form is closed and I try to close the main form.  The grid form re-display again.  I have to keep clicking cancel several times before I am able to exit from the main form.  Is there something that I need to clear?

               var displayMessage = "Are you sure you want to save the comment?\n\n **** If you select 'OK' the screen will close.";
                Xrm.Utility.confirmDialog(displayMessage,
                    function () {
                        setTimeout(function () {
                            if (templateTypeMode.text != "") {
                                var caseId = Xrm.Page.getAttribute("new_caseid").getValue()[0].id.replace(/{/g, "").replace(/}/g, "");
                                var caseDataSheetTemplateId = Xrm.Page.data.entity.getId().replace(/{/g, "").replace(/}/g, "");

                                var new_datatracking = {
                                    "new_caseid": caseId,
                                    "new_casedatasheettemplateid": caseDataSheetTemplateId.toString(),
                                    "new_templatetypemode": templateTypeMode.value.toString(),
                                    "new_reasonid": reasonId,
                                    "new_comment": comment.toString()
                                };

                                callCaseActionPlugin(new_datatracking);

                                setTimeout(function () {
                                    alert("Comment has been save!");

                                    Xrm.Page.ui.close();
                                }, 3000);
                            }
                        }, 10);
                    },


                function () {
                    setTimeout(function () {
                    }, 10);
                }
                );



*This post is locked for comments

I have the same question (0)
  • Verified answer
    rthompson Profile Picture
    1,532 on at

    Fixed my issue:

    Needed to change my logic to handle 2 conditions.

    switch (type) {
        case "Grid":
    If working from a grid I needs to use
              Xrm.Utility.openEntityForm(entityName, entityId);
              break;
         case "View":
    If working from a view I need to use
              Xrm.Page.data.entity.save("saveandclose");
              break;
    }


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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans