# Attribute Error in Component Custom Method

**URL:** <https://forum.inductiveautomation.com/t/attribute-error-in-component-custom-method/47712>\
**Category:** Ignition\
**Tags:** ignition81, scripting, vision\
**Created:** [June 11, 2021, 6:08pm UTC](https://forum.inductiveautomation.com/t/attribute-error-in-component-custom-method/47712 "2021-06-11T18:08:04Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [June 11, 2021, 8:15pm UTC](https://forum.inductiveautomation.com/t/attribute-error-in-component-custom-method/47712/18 "2021-06-11T20:15:45Z")

</div>

**Hello All,**

The custom method definitely (seems at least anyway) can’t reference system.tag but I found a solution (more like a work-around?) thanks to @silverbacknet (post [Using system.\* inside a custom function? - #9 by systemparadox](http://forum.inductiveautomation.com/t/using-system-inside-a-custom-function/12355/9)) where a reference to `system.tag` must be passed as an argument to the custom method. It works and is not messy.

This is my buttons actionPerformed script, see line 5 (`import system.tag as sysTag`) and the last line.

```auto
# ==========================================================================
# Commit the version notes and increment the version number...only after everything is validated.
# ==========================================================================
# The import is needed for the custom methods...refer to line 42.
import system.tag as sysTag
# The three user input fields must be validated.
projectArea = event.source.parent.getComponent('dd_projectArea').selectedStringValue
topic = event.source.parent.getComponent('ta_topic').text
notes = event.source.parent.getComponent('ta_versionNotes').text

if (projectArea == ''):
	system.gui.messageBox("You must select a project area.")
elif (topic == ''):
	system.gui.messageBox("You must enter a topic.")
elif (notes == ''):
	system.gui.messageBox("You must enter notes.")
else:
	if system.gui.confirm(
		"Are you sure you want to commit these notes and increment the version?",
		"Commit"):
			selectedVersion = event.source.parent.versionNumber
			if (selectedVersion == 0):
				event.source.forgetVersionInfo()
				system.nav.closeParentWindow(event)
				event.source.resetAllVerNums(projectArea, topic, notes)
			elif (selectedVersion == 1):
				event.source.forgetVersionInfo()
				system.nav.closeParentWindow(event)
				event.source.incrementVerNum1st(projectArea, topic, notes)
			elif (selectedVersion == 2):
				event.source.forgetVersionInfo()
				system.nav.closeParentWindow(event)
				event.source.incrementVerNum2nd(projectArea, topic, notes)
			elif (selectedVersion == 3):
				event.source.forgetVersionInfo()
				system.nav.closeParentWindow(event)
				event.source.incrementVerNum3rd(projectArea, topic, notes)
			else:
				event.source.forgetVersionInfo()
				system.nav.closeParentWindow(event)
				event.source.incrementVerNum4th(projectArea, topic, notes, sysTag)

```

This is the custom method where I was getting the error, but with a system.tag reference argument it works nicely.

```auto
def incrementVerNum4th(projectArea, topic, notes, sysTag):
	# =====================================================================
	# Increments the 4th version number (work in progress).
	# <major> . <feature> . <bug fix> . <work in progress>
	# =====================================================================
	newVerNum = sysTag.readBlocking('[gw1]_Project Version Information/verNum4th')[0].value + 1
	sysTag.writeBlocking('[gw1]_Project Version Information/verNum4th', newVerNum)
	self.addVersionNote(projectArea, topic, notes, sysTag)

```

Thank you everyone for you assistance, it so nice to have volunteers like yourselves. I’ve been Ignition’ing for about a month…maybe after 12 months I’ll have enough experience to help others 🙂  
Regards,  
Ted.

---

_[View the full topic](https://forum.inductiveautomation.com/t/attribute-error-in-component-custom-method/47712)._
