# Possible to disable ReadOnly tag property thru scripting?

**URL:** <https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295>\
**Category:** Ignition\
**Created:** [December 6, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295 "2022-12-06T15:10:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [December 6, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/1 "2022-12-06T15:10:29Z")

</div>

I have cause thru scripting to disable then re-enable later the ReadOnly properties of tags. I try with scripting and get this error that makes sense lol. Is there a way or you have to do thru tag browser?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/cacfb7651a6887d8004e0729fcd4561739abf1a2.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2022, 3:38pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/2 "2022-12-06T15:38:29Z")

</div>

writeblocking can be used to change this value  
`system.tag.writeBlocking(['[Sample_Tags]TagPath/YourTag.ReadOnly'], ['true'])`  
~~or  
 `system.tag.writeBlocking(['[Sample_Tags]TagPath/YourTag.ReadOnly'], ['false'])`~~

It can be set to true, but once it's read only, it's read only

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [December 6, 2022, 5:07pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/3 "2022-12-06T17:07:53Z")

</div>

> [@justinedwards.jle](#):
>
> but once it's read only, it's read only

That is a pita for me lol.

I need to write to the AlarmEvalEnabled property of a read only tag.... I can understand not being able to write to the .value prop

---

<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:** [December 6, 2022, 5:10pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/4 "2022-12-06T17:10:21Z")

</div>

Have you tried using `system.tag.configure()`?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2022, 5:22pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/5 "2022-12-06T17:22:56Z")

</div>

I considered this as well, but based on the behavior of `system.tag.getConfiguration()`, it doesn't seem like it is possible to manipulate the read only property in this way. Am I mistaken about this?

---

<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:** [December 6, 2022, 5:31pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/6 "2022-12-06T17:31:48Z")

</div>

Since tags are not read only by default, once the property is set to `True` I would expect it to show up in the configuration pulled with `system.tag.getConfiguration()`.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2022, 5:38pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/7 "2022-12-06T17:38:14Z")

</div>

You are correct. I just set up a test, and the script pulled in the read only value:  
**Code:**

```auto
tagConfig = system.tag.getConfiguration('[Sample_Tags]Realistic/Realistic0')
for tagDict in tagConfig:
    for key, value in tagDict.iteritems():
    	if key == 'readOnly':
        	print key, ' : ', value

```

**Output:**

```auto
readOnly : True

```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2022, 6:25pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/8 "2022-12-06T18:25:35Z")

</div>

I haven't been able to get `system.tag.configure` to work for changing read only.  
**Here is my code:**

```auto
tagConfig = system.tag.getConfiguration('[Sample_Tags]Realistic/Realistic0', False)
print tagConfig
print
for index, tagDict in enumerate(tagConfig):
    for key, value in tagDict.iteritems():
    	if key == 'readOnly':
    		tagConfig[index]['readOnly'] = False
print tagConfig
print 
print system.tag.configure('[Sample_Tags]Realistic/Realistic0', tagConfig, "o")

```

**Here is my output:**

```auto
[{u'historyEnabled': True, u'historicalDeadband': 0.1, u'dataType': Float8, u'readOnly': True, u'enabled': True, u'historyProvider': u'Sample_SQLite_Database', u'path': [Sample_Tags]Realistic/Realistic0, u'opcItemPath': u'ns=1;s=[Sample_Device]_Meta:Realistic/Realistic0', u'tagType': AtomicTag, u'name': u'Realistic0', u'opcServer': u'Ignition OPC UA Server', u'valueSource': u'opc'}]

[{u'historyEnabled': True, u'historicalDeadband': 0.1, u'dataType': Float8, u'readOnly': False, u'enabled': True, u'historyProvider': u'Sample_SQLite_Database', u'path': [Sample_Tags]Realistic/Realistic0, u'opcItemPath': u'ns=1;s=[Sample_Device]_Meta:Realistic/Realistic0', u'tagType': AtomicTag, u'name': u'Realistic0', u'opcServer': u'Ignition OPC UA Server', u'valueSource': u'opc'}]

[Bad_Unsupported("The target path '[Sample_Tags]Realistic/Realistic0' cannot accept children tags.")]

```

---

<div class="post-metadata">

**Author:** ![wildbilly](https://avatars.discourse-cdn.com/v4/letter/w/e19adc/32.png) [@wildbilly](https://forum.inductiveautomation.com/u/wildbilly)\
**Post date:** [December 6, 2022, 8:30pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/9 "2022-12-06T20:30:42Z")

</div>

when you write the config back you need to go up one layer

```auto
print system.tag.configure('[Sample_Tags]Realistic/', tagConfig, "o")
```

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 6, 2022, 11:57pm UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/10 "2022-12-06T23:57:22Z")

</div>

> [@wildbilly](#):
>
> go up one layer

Yes. That is the key -- Read only is turned off on my test tag after making this change

Edit: putting all together:

```auto
tagPath = '[Default]YourTagPath'
tag = 'YourTagName'
tagConfig = system.tag.getConfiguration(tagPath + '/'+ tag, False)
for index, tagDict in enumerate(tagConfig):
    for key, value in tagDict.iteritems():
    	if key == 'readOnly':
    		tagConfig[index]['readOnly'] = False
system.tag.configure(tagPath, tagConfig, "o")
#======================
#Do tag writing here
#======================
system.tag.writeBlocking([tagPath + '/'+ tag + '.ReadOnly'], ['true'])

```

---

<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:** [December 7, 2022, 2:07am UTC](https://forum.inductiveautomation.com/t/possible-to-disable-readonly-tag-property-thru-scripting/67295/11 "2022-12-07T02:07:01Z")

</div>

Just a note to say that unless you need to ensure the write is successful, you can use `system.tag.writeAsync()` here in place of `system.tag.writeBlocking()`. And also that you should be able to include all of the writes in one call.
