# Enable valueChanged eventScript using system.tag.getConfiguration

**URL:** <https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182>\
**Category:** Ignition\
**Created:** [April 16, 2025, 4:08pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182 "2025-04-16T16:08:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 4:08pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/1 "2025-04-16T16:08:03Z")

</div>

Is there a way to enable an eventScript that exist on a tag via script? I've tried using the system.tag.getConfiguration method but I keep getting an error stating 'Bad\_Unsupported - The target path cannot accept children tags'.

Does anyone happen to have an example or have been able to successful accomplish this?

---

<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:** [April 16, 2025, 4:19pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/2 "2025-04-16T16:19:03Z")

</div>

Post your code and format it using the \</\> button.

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 4:27pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/3 "2025-04-16T16:27:32Z")

</div>

path = "[METERS]TEST\_ENABLE"

# Get current tag configuration

```python
config = system.tag.getConfiguration(path, True)[0]
scriptEnabled = eventScripts[0]['enabled']=True 
system.tag.configure(path, [config], "o")

```

---

<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:** [April 16, 2025, 4:30pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/4 "2025-04-16T16:30:03Z")

</div>

> [@Transistor](#):
>
> and format it using the \</\> button.

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 4:42pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/5 "2025-04-16T16:42:35Z")

</div>

```python
config = system.tag.getConfiguration(path, True)[0]
scriptEnabled = eventScripts[0]['enabled']=True
system.tag.configure(path, [config], "o")

```

---

<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:** [April 16, 2025, 4:48pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/6 "2025-04-16T16:48:46Z")

</div>

Your script is referencing an undefined variable. It should be something like:

```python
config = system.tag.getConfiguration(path,True)[0]['eventScripts']
config[0]['enabled'] = True
system.tag.configure(path,[config],'o')

```

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 6:04pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/7 "2025-04-16T18:04:50Z")

</div>

Ahhh good catch. I actually had it written out quite a few ways and forgot to update the variable. It still throws an error, even when I correct the variable name.

[Error\_Configuration("java.lang.IllegalArgumentException: Error converting non dictionary object to tag edit.")

---

<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:** [April 16, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/8 "2025-04-16T18:14:30Z")

</div>

You'll have to show your script as written when the error was produced.

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 6:15pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/9 "2025-04-16T18:15:16Z")

</div>

```python
path = "[METERS]TEST_ENABLE"

config = system.tag.getConfiguration(path,True)[0]['eventScripts']
config[0]['enabled'] = True
system.tag.configure(path,[config],'o')

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 16, 2025, 6:33pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/10 "2025-04-16T18:33:38Z")

</div>

There's a slight mismatch between `system.tag.getConfiguration` and `system.tag.configure` in that the latter expects the path supplied to be the folder in which to work, where the former will enumerate a folder if given a folder, but returns a single-entry list if given a path to an actual tag.

Change the path supplied to `system.tag.configure` to exclude the leaf tag name.

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 7:42pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/11 "2025-04-16T19:42:16Z")

</div>

Thank you!

Now I am getting a KeyError on 'eventScripts'.

```python
path = "[METERS]ENABLE_SCRIPT/TEST_ENABLE
basePath = "[METERS]ENABLE_SCRIPT"

config = system.tag.getConfiguration(path,True)[0]['eventScripts']
config[0]['enabled'] = True
system.tag.configure(basePath,[config],'o')

```

Here is the config that is returned.

{u'tags': [{u'path': TEST\_ENABLE, u'tagType': AtomicTag, u'name': u'TEST\_ENABLE', u'eventScripts': [{u'eventid': u'valueChanged', u'script': u'\tsystem.perspective.print("HI")', u'enabled': False}], u'valueSource': u'memory'}], u'path': [METERS]ENABLE\_SCRIPT, u'tagType': Folder, u'name': u'ENABLE\_SCRIPT'}

---

<div class="post-metadata">

**Author:** ![alainia.spencer](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@alainia.spencer](https://forum.inductiveautomation.com/u/alainia.spencer)\
**Post date:** [April 16, 2025, 8:00pm UTC](https://forum.inductiveautomation.com/t/enable-valuechanged-eventscript-using-system-tag-getconfiguration/105182/12 "2025-04-16T20:00:59Z")

</div>

Got a working example, thanks for the help!

```python
tagObject = {
	'eventScripts':[{
		"eventid": "valueChanged",
		"script": "\t test",
		"enabled":True
	}],
	'name':'scriptTagTest'
 
}
 
basePath= '[Cochina]'
system.tag.configure(basePath, [tagObject],'m')

```
