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

Announcements

News and Announcements icon
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 276

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
    276 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
    276 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard