# \[SOLVED\] What is the syntax for sending a message from a popup in Perspective to refresh a binding on the root of a view?

**URL:** <https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [December 27, 2022, 11:12pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011 "2022-12-27T23:12:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 27, 2022, 11:12pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011/1 "2022-12-27T23:12:25Z")

</div>

I have a view called **main**. I want to refresh a binding on **main** from a script running in a popup window called **my\_popup**.

The code on a button in **my\_popup** is:

```auto
messageType = 'tbl_Refresh_Data'
system.perspective.sendMessage(messageType, scope='page')
```

Back on my view called **main** on the **root** I have a message handler called **tbl\_Refresh\_Data** listening in the page scope. The code on the message handler script is:

```auto
self.refreshBinding("self.custom.cells")
```

When I press the button on **my\_popup** I get the gateway error message in the logs:

```auto
	Error running listCells/main@C/root.onMessageReceived(self, payload): Traceback (most recent call last): File "<function:onMessageReceived>", line 3, in onMessageReceived at com.inductiveautomation.perspective.common.api.PropertyKey.fromString(PropertyKey.java:48) at com.inductiveautomation.perspective.gateway.script.ComponentModelScriptWrapper$SafetyWrapper.refreshBinding(ComponentModelScriptWrapper.java:93) at jdk.internal.reflect.GeneratedMethodAccessor202.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Invalid property key - no scope defined: self.custom.cells 
```

which seems to be telling me that "self.custom.cells" doesn't exist however I picked "self.custom.cells" from the built in binding selector.

Does anyone know what I am doing wrong? I am new to Perspective message handlers so I could be making a mistake somewhere.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 27, 2022, 11:37pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011/2 "2022-12-27T23:37:06Z")

</div>

The manual shows that the syntax is  
`system.perspective.sendMessage(messageType, payload, [scope], [sessionId], [pageId])`  
Note that `payload` isn't optional so you need to add an empty dictionary, `payload = {}`. See if

```auto
messageType = 'tbl_Refresh_Data'
system.perspective.sendMessage(messageType, payload = {}, scope='page')

```

does the job.

The error message, `Invalid property key - no scope defined: self.custom.cells` is a little confusing but I suspect that it has taken your scope parameter as the payload parameter and then found the third parameter was missing.

[https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage](https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage)

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [December 28, 2022, 12:14am UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011/3 "2022-12-28T00:14:04Z")

</div>

Try deleting the self before self.custom.cells as you have already defined self before refreshbinding.

```auto

self.refreshBinding("custom.cells")

```

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 28, 2022, 1:24pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011/4 "2022-12-28T13:24:37Z")

</div>

I thought so but it appears that payload is also optional.

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [December 28, 2022, 1:25pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-syntax-for-sending-a-message-from-a-popup-in-perspective-to-refresh-a-binding-on-the-root-of-a-view/68011/5 "2022-12-28T13:25:50Z")

</div>

This was the solution... a very strange issue and annoying.
