# addHoliday Function issue

**URL:** <https://forum.inductiveautomation.com/t/addholiday-function-issue/27943>\
**Category:** Ignition\
**Created:** [September 2, 2019, 4:43am UTC](https://forum.inductiveautomation.com/t/addholiday-function-issue/27943 "2019-09-02T04:43:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew.Zebic](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Andrew.Zebic](https://forum.inductiveautomation.com/u/Andrew.Zebic)\
**Post date:** [September 2, 2019, 4:43am UTC](https://forum.inductiveautomation.com/t/addholiday-function-issue/27943/1 "2019-09-02T04:43:52Z")

</div>

Hi,  
I’m trying to use the function system.user.addHoliday in perspective. On a button click it activates the following script:

```auto
def runAction(self, event):
	"""
	Method that will run whenever the selected event fires.

	Arguments:
		self: A reference to the component that is invoking this function.
		event: An object that holds information about the selected event type
	"""
	# Write your script here
	from java.util import Date
	try:
		name = self.getSibling("TextField").props.text
		date = Date(self.getSibling("DateTimeInput").props.value)
		date = system.date.format(date,"dd/MM/yyyy")
		repeat = self.getSibling("Checkbox").props.selected
	except Exception:
		response = "Info couldn't be retrieved"
	try:
		response = project.pyEightLegsUsers.addHoliday()
	except Exception:
		response = "Holiday couldn't be added"
	self.getSibling("Response").props.text=response

```

This script utilizes the following code:

```auto
def printResponse(responseList):
	if len(responseList) > 0:
		for response in responseList:
			print "", response
	else:
		print " None"

def addHoliday():
	from java.util import Date
	response = False
	name = 'adsfasf'
	date = Date(100,1,1)
	newHoliday = HolidayModel(name,date,repeat)
	response = system.user.addHoliday(newHoliday)
	return infos[0]

```

The issue that I am having is that whenever I call addHoliday() from the Script Console tool, it successfully adds in the holiday without issues, however when it is called from the button script the second exception is always fired (Holiday could not be added). I am wondering how to fix this?

Thanks for the help,  
Andrew

---

<div class="post-metadata">

**Author:** ![Andrew.Zebic](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Andrew.Zebic](https://forum.inductiveautomation.com/u/Andrew.Zebic)\
**Post date:** [September 2, 2019, 6:29am UTC](https://forum.inductiveautomation.com/t/addholiday-function-issue/27943/2 "2019-09-02T06:29:35Z")

</div>

Nevermind, I went though this function and realized all the bugs that I had in it. I have fixed it since.

Thanks,

Andrew.
