# Refresh perspective component on tag change

**URL:** <https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [August 17, 2023, 12:48am UTC](https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969 "2023-08-17T00:48:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_S](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@R\_S](https://forum.inductiveautomation.com/u/R_S)\
**Post date:** [August 17, 2023, 12:48am UTC](https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969/1 "2023-08-17T00:48:22Z")

</div>

Is it possible to refresh a perspective view component on tag change?

Specifically, I am after updating a table which I have previously updated using self.refreshBinding("props.data") through a message handler for user triggered events. However I would like to also trigger a refresh for a gateway event that flags completion with a tag change.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 17, 2023, 12:57am UTC](https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969/2 "2023-08-17T00:57:36Z")

</div>

The same message handler method is the answer here. You just have to reference the project in the call.

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

---

<div class="post-metadata">

**Author:** ![R\_S](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@R\_S](https://forum.inductiveautomation.com/u/R_S)\
**Post date:** [August 17, 2023, 2:38am UTC](https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969/3 "2023-08-17T02:38:50Z")

</div>

I'm getting an error trying to do that. The message handler needs to be initiated from the gateway but received by all browser sessions currently open.  
I'm sending:

```auto
system.util.sendMessage("Enterprise", "refresh", {"target":"target_test"},"CG")

```

I've set up a label in a view with a message handler called "refresh" and ticked all the listen scopes (Session,Page,View):

```auto
def onMessageReceived(self, payload):
	target = payload["target"]
	if target == "target_test":
		self.props.text = "message received"

```

I've tried setting the scope to send the message with to different combinations of "C","G" and "S" but it either isn't received or when set to "G" I get a gateway error logged because there isn't any message handler defined in the gateway scope.

Any ideas what I'm doing wrong?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 17, 2023, 2:42am UTC](https://forum.inductiveautomation.com/t/refresh-perspective-component-on-tag-change/77969/4 "2023-08-17T02:42:48Z")

</div>

You need to add a message handler in session events that will the broadcast a component level message using system._perspective_.sendMessage.
