Closing Popup on Save

Here is the solution.

If you want to use a Reusable Element as the form body in a popup, you set a custom state on your reusable element and then you set up a trigger on that element at the form level. Here is what I did step by step:

  • I went to my Reusable Element and when the save button was closed, I added a custom state called “shouldClose” and set it to type “YES/NO” and a default of “YES” every time the save button is clicked
  • then, I went to my form that hosts the popup and added a custom trigger that runs every time that also checks for that state
  • step 1 of that custom event is to look for “shouldClose = YES” and if so to close the popup
  • step 2 of that custom event is to set the value to “NO” so it doesn’t run until called again
  • then, in my button that launches the popup, I set the state to “NO” there as well.

So, when the button is clicked, the state is NO and the popup stays open. When I click Save, it sets it to YES and it triggers the form-level event that happens to be the parent of the popup and that event closes it.

Works nicely!