web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Closing a Popup form w...
Power Apps
Unanswered

Closing a Popup form without Navigating

(2) ShareShare
ReportReport
Posted on by 274

Use case: Users want to click one button to say that the question has been answered and that will 1) mark the question as read only (inactive) and 2) close the current popup form (which was opened from a model driven app via a JavaScript). 

Reason: The reason I don't want to Navigate is that I need the user to land right back on the same location on the subgrid.  They might be scrolled thru 50+ questions and Navigation is going to reset the subgrid and force them for every question to have to find it again.  Too much pain.

What I have in place now is a custom Fx button "Answered" that can change the statuscode and status reason values, which addresses #1.  Now how to close the popup without using the Navigation option?

damian_green23_0-1709604903026.png

What might the code be for this button to close the Inspection Question form, which will by doing so, show the form it was popped up from?

damian_green23_1-1709605038705.png

 

 

Categories:
I have the same question (0)
  • damian_green23 Profile Picture
    274 on at

    ChatGPT is recommending changing the code to JavaScript.  Now trying to implement it.

    I've create the new webresource (using the exact same Patch code that worked from above) and added the close current window code), updated the button to run on the new JavaScript code, published all customizations, but so far it's not doing anything. 

     

     

    function markQuestionAsAnswered() {
     // Get the selected item
     var selectedQuestion = Self.Selected.Item;
    
     // Update the status and status reason using Patch
     Patch('Inspection Questions', selectedQuestion,
     {
     Status: 'Status (Inspection Questions)'.Inactive,
     statuscode: 'Status Reason (Inspection Questions)'.Answered
     }
     );
    
     // Close the current popup form
     window.parent.Xrm.Page.ui.close();
    
     // Refresh the parent form to reflect the changes
     window.opener.location.reload();
    }

     

    Clicking the Answered button and the form doesn't change.  Doesn't change status.  Doesn't close.... 

    The Javascript is in the Code, within the Solution.....

  • damian_green23 Profile Picture
    274 on at
    Can anyone help me with this?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard