# Message Handler not working in popup

**URL:** <https://forum.inductiveautomation.com/t/message-handler-not-working-in-popup/40924>\
**Category:** Ignition\
**Tags:** perspective, ignition80\
**Created:** [November 24, 2020, 4:39pm UTC](https://forum.inductiveautomation.com/t/message-handler-not-working-in-popup/40924 "2020-11-24T16:39:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [November 24, 2020, 4:39pm UTC](https://forum.inductiveautomation.com/t/message-handler-not-working-in-popup/40924/1 "2020-11-24T16:39:22Z")

</div>

Hello,

I need help regarding message handler which I am listening in the popup.

### Alert Popup Screenshot with Message Handler

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/74a09a1a666b47192880c4107a2e2cb0a2713579.png)

I have a table in view called **Recipes** and there is a popup called **alert**. What I am doing is when user presses a **Reload** button present on view **Recipes** , the popup **alert**.opens. There are 2 buttons on a popup **alert**. When user presses button **Confirm Overwrite** it reads the values of particular column from the table present in view called **Recipes**. For this I am passing table data as a payload and opening a popup. see snip below

#### Sending Message Screenshot upon pressing Reload

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f07ba8310206b3916fbd335add14cb9b4c6c8f3e.png)

In _2.Script_, I am only opening a popup.

However this seems not working and I am not getting issue. for a trial I also added a label in a popup and listening _payload['dropdownValue']_ in the label.props.text but still no luck.

Please let me know if you need any more screenshots if its not clear and help me on this. Thanks!

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 24, 2020, 5:00pm UTC](https://forum.inductiveautomation.com/t/message-handler-not-working-in-popup/40924/2 "2020-11-24T17:00:59Z")

</div>

You should look at the Gateway logs for errors from your scripts. I’m 99% sure your scripts are failing.

```auto
# this should work, assuming the data supplied for 'table' is correct. 
self.props.data = payload['table']

# this should NOT be done; this would probably result in a component error.
self = payload['table']

```

If you’d like to supply the view.json files I could take a look at the scripts to see what is not working. I would also recommend that you supply some logging at the start of each script to verify the script is being invoked:

```auto
# change the value of x to be whatever the script is doing.
system.perspective.print('start script x')

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 25, 2020, 4:30pm UTC](https://forum.inductiveautomation.com/t/message-handler-not-working-in-popup/40924/3 "2020-11-25T16:30:48Z")

</div>

What LOOKS to be happening is that the popup is opening, but the table has no data. This is occurring because the two Actions you supplied to be invoked for the click event of the button are executing asynchronously; the sendMessage call is probably being invoked/executed before the popup has been built on the page.

Think of it like this: you are saying “hello” before the Popup has picked up the phone.

Solution:  
You should pass the table data to the project script, which in turn passes that value to the openPopup invocation as the `params` argument:

```auto
def showAlert(x, y, z, payload):
    system.perspective.openPopup(x, y, z, params=payload)

```

The Popup View should then have a `table_data` param to receive this info, and the Table should bind against that param value.
