Skip to main content

Notifications

Power Apps - Building 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:
  • damian_green23 Profile Picture
    damian_green23 274 on at
    Closing a Popup form without Navigating
    Can anyone help me with this?
  • damian_green23 Profile Picture
    damian_green23 274 on at
    Re: Closing a Popup form without Navigating

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

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard