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
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; }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156