# Custom Property Change Script Execution

**URL:** <https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 18, 2021, 8:28pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256 "2021-11-18T20:28:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 18, 2021, 8:28pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/1 "2021-11-18T20:28:17Z")

</div>

Hi all,

I have a question regarding how the change script on a custom property under a view works and executes. Here is what I have set it up:

- 15 pieces of pipes using the pipe tool in perspective in a view called “PID”

- created a custom property called “EM\_Scheme” and this custom property is bound to an OPC tag

- placed a change script on the “EM\_scheme” custom property. If it is equal to 1, the scripts will set pipes 0, 1, and 4 to color blue with fill and stroke props. If it is equal to 3, the script will set pipes 5,6, and 8 to yellow with fill and stroke props. These are just examples that I used. The script I tested below might not match but the point remains.

But when I was testing it, the script only executed successfully in the designer view but the session view didn’t update with the correct pipe color.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5f1b6b65e136125f9d860217b0fc6be0aefd50d.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/f/5fe093a5443f3c51b81035522b2af022477a8d07.png)

Has anyone encountered the same issue? Is there a fix for this?

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [November 18, 2021, 8:57pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/2 "2021-11-18T20:57:46Z")

</div>

Is what you’ve posted your entire script?

I’d think you need to be setting/resetting the colors for all pipes for each possible flow path. Just because one state sets the color to `noflow` doesn’t mean all other states automatically set the color to `hasflow`.

---

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 18, 2021, 9:09pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/3 "2021-11-18T21:09:32Z")

</div>

I did have the reset, and it is when EM\_scheme = 0. what I posted was a bad example. I think my question is why the script only works in designer but not client.

---

<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 19, 2021, 2:41am UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/4 "2021-11-19T02:41:52Z")

</div>

Do you see any errors in the gateway logs when you try this? Since the custom property isn’t persistent, I know some users have encountered problems because the first time you try to use `currentValue.value` you’ll hit an exception because currentValue is `None`.

---

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 19, 2021, 3:19am UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/6 "2021-11-19T03:19:23Z")

</div>

Actually I found the problem…My color for no flow is missing a #

---

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 19, 2021, 3:30am UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/7 "2021-11-19T03:30:31Z")

</div>

I do have another question. Between direct binding and the property change script for pipe color change, is one better than the other? The property change script is definitely better in terms of development time. I’m curious about robustness.

---

<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 19, 2021, 6:27am UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/8 "2021-11-19T06:27:45Z")

</div>

I personally recommend bindings when you can. While you might think that the change script is easier or faster, it’s also less clear later during maintenance when you’re trying to find how a value keeps changing because the process actually changing it is hidden on some other proeprty.

---

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 19, 2021, 1:44pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/9 "2021-11-19T13:44:11Z")

</div>

But performance-wise, they are not significantly different?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 19, 2021, 1:55pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/10 "2021-11-19T13:55:11Z")

</div>

Anything that involves a executing a Jython script is slower than the alternative that doesn’t.

---

<div class="post-metadata">

**Author:** ![jfan](https://avatars.discourse-cdn.com/v4/letter/j/e8c25b/32.png) [@jfan](https://forum.inductiveautomation.com/u/jfan)\
**Post date:** [November 19, 2021, 2:08pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/11 "2021-11-19T14:08:42Z")

</div>

The difference is I am using one or two scripts to evaluate all the pipes, whereas there could be 50 pieces of pipes and each of them has binding and transform. Is direct binding still the better performance approach in this case?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 19, 2021, 2:10pm UTC](https://forum.inductiveautomation.com/t/custom-property-change-script-execution/53256/12 "2021-11-19T14:10:17Z")

</div>

Ah, I don’t know for sure 🤷‍♂️
