# How to get the ids of all open popups? (to close them all)

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 20, 2025, 11:50am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617 "2025-06-20T11:50:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 20, 2025, 11:50am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/1 "2025-06-20T11:50:36Z")

</div>

I need to be able to close all open popups when the page is changed, so I need to be able to get a list of all of the open popup ids, but I'm struggling to find how I would do this.. help! 🙂

Edit: I have a dodgy solution.. just call `system.perspective.closePopup('')` a number of times...

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [June 20, 2025, 12:06pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/2 "2025-06-20T12:06:16Z")

</div>

you could either manage a list of ids and then close them that way

or for each popup just have a message handler that is the same on all of them that runs system.perspective.closepopup for the id. you'd still likley have to put the popup id into each respective one

---

<div class="post-metadata">

**Author:** ![Chris\_Bingham](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@Chris\_Bingham](https://forum.inductiveautomation.com/u/Chris_Bingham)\
**Post date:** [June 20, 2025, 2:23pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/3 "2025-06-20T14:23:45Z")

</div>

I did find a relevant post I stumbled on in the past (hint: use a message handler).

> [@How to close popup when screen changes?](https://forum.inductiveautomation.com/t/how-to-close-popup-when-screen-changes/68690/8):
>
> In addition to the quick-and-dirty avenue I already supplied, there's two other ways to do this. More correct: In the onShutdown Event script for the View in question, close out all "known" Popups for the View. known\_popup\_ids = ["a", "b", "c"] for popup\_id in known\_popup\_ids: system.perspective.closePopup(id=popup\_id) This requires you to always update the list of potential Popups, so this is inherently brittle as you develop and add more content. Additionally, there is always the possi…

Scroll up a few posts to find a version of your 'dodgy solution' 😄

The above aside, I do wish there was a built-in to retrieve information about all open popups (and their z-order) of a session.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 20, 2025, 10:58pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/4 "2025-06-20T22:58:09Z")

</div>

Thanks for the replies.

It looks like it isn't possible without some management effort on my part which is susceptible to being forgotten, particularly if other devs are involved who simply aren't aware.

I'll keep my spam call of closePopup("") for now as this does work, it just feels wrong..

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 21, 2025, 6:48am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/5 "2025-06-21T06:48:25Z")

</div>

I find the message option quite easy to implement, without requiring any special kind of management, all you need is a parameter with the popup's id.  
Then popups are responsible for closing themselves when catching the message.  
This gives you a lot of flexibility:

- Don't implement the handler on a particular popup if it should stay open
- Add some context to the message through the payload for conditional handling

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 21, 2025, 8:18am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/6 "2025-06-21T08:18:47Z")

</div>

It's more that whenever a new popup is created, the person needs to know and remember to add the thing to it, I'd rather it just be inherent

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 21, 2025, 8:27am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/7 "2025-06-21T08:27:37Z")

</div>

You could make a wrapper function + view to streamline it. Though that's really not my favorite thing.

I do have a wrapper function to open popups, that generates an uuid and assigns it as the popup's id, but the wrapper view is... ugh

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [June 21, 2025, 9:39am UTC](https://forum.inductiveautomation.com/t/how-to-get-the-ids-of-all-open-popups-to-close-them-all/107617/8 "2025-06-21T09:39:17Z")

</div>

> [@pascal.fragnoud](#):
>
> I do have a wrapper function to open popups, that generates an uuid and assigns it as the popup's id, but the wrapper view is... ugh

I do both of these already, the 2nd one kind of for device popups. I have a single popup that I use for all device types (motors/valves/analogues/etc) that has a standard set of tabs with some that hide based on device type. The tab contents for some of them are defined within separate Views, while other more standard tabs like trends, interlocks, alarms etc. are all defined within the popup itself. So I actually don't have a lot of popups.. but still 🤷‍♂️
