# Want to set control value to multistate button

**URL:** <https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061>\
**Category:** Ignition\
**Created:** [November 15, 2021, 8:11am UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061 "2021-11-15T08:11:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 8:11am UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/1 "2021-11-15T08:11:45Z")

</div>

Hi,  
I am using multistate button on screen and I want to set the control value to the multistate button from different screen.  
According to control value I need to set embedded view path.

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

In above image there is search button, from that search button I am passing controlvalue through message handler but it is not receiving on main screen.  
also I have tried by passing parameter from popup to main screen,still it is not working.  
Whats wrong here?  
Please help.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 11:53am UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/2 "2021-11-15T11:53:24Z")

</div>

any idea or suggestion for this?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 15, 2021, 12:08pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/3 "2021-11-15T12:08:05Z")

</div>

a messagehandler should work, can you show me how you use it?

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 12:12pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/4 "2021-11-15T12:12:29Z")

</div>

sure.  
From Serarch button click, like below I am passing selected value parameter

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/c/8c56b50a5cff7d173657bd304618a8b01c66c600.png)

And on message Handler I am passing payload value to the controlValue of multisate button. Here 1st line print also not working, means it is not calling this handler.  
This Handler is on root of main screen.

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

---

<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:** [November 15, 2021, 12:20pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/5 "2021-11-15T12:20:17Z")

</div>

So I presume “calling Handler” and “calling Handler complte” are printing but not the prints inside the message handler?

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 12:22pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/6 "2021-11-15T12:22:01Z")

</div>

yes,right.

---

<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:** [November 15, 2021, 12:22pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/7 "2021-11-15T12:22:33Z")

</div>

Oh, I see the issue. You’re closing the popup before the script finishes. You need to close it at the very end. The thread terminates (I believe) when the View terminates

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 12:25pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/8 "2021-11-15T12:25:10Z")

</div>

initially it was at the end still it is not working,so I moved it up, I thought after closing the popup, back screen will be in focus and handler will get the call.  
again will try by closing at end.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 12:29pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/9 "2021-11-15T12:29:34Z")

</div>

Still not working.

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

---

<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:** [November 15, 2021, 12:46pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/10 "2021-11-15T12:46:05Z")

</div>

I think you need to `import sys` in your handler. I can see it referenced in the very bottom of your screenshot. Probably not your issue though…

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [November 15, 2021, 12:51pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/11 "2021-11-15T12:51:07Z")

</div>

No, still not working.

---

<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:** [November 15, 2021, 1:32pm UTC](https://forum.inductiveautomation.com/t/want-to-set-control-value-to-multistate-button/53061/12 "2021-11-15T13:32:01Z")

</div>

🤷‍♂️ This works for me [MessageHandlerTest.zip](https://forum.inductiveautomation.com/uploads/short-url/hKnBENQ4AdhAjClgYieOCjKLGYj.zip) (6.2 KB)
