# Disable add roster button in the roster management

**URL:** <https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [January 14, 2022, 5:22pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038 "2022-01-14T17:22:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mario.gutierrez](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mario.gutierrez](https://forum.inductiveautomation.com/u/mario.gutierrez)\
**Post date:** [January 14, 2022, 5:22pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038/1 "2022-01-14T17:22:03Z")

</div>

Hello,

I am trying to disable the add roster button and delete roster button in the roster management component in vision (user are not supposed to add or delete rosters). how is that possible?

Thanks,

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [January 14, 2022, 6:07pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038/2 "2022-01-14T18:07:54Z")

</div>

Are you allowing users to edit rosters? But not create or delete?

If they can’t edit it at all, you can just disable user management from project properties for their user level.

I don’t think you can disable add,delete but allow edit. So a workaround might be covering said button with an object so it can’t be seen or clicked.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [January 14, 2022, 7:17pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038/3 "2022-01-14T19:17:29Z")

</div>

The add and delete buttons aren’t available through scripting. The best you can do without creating your own component is to use the onCreateRoster and onDeleteRoster extension functions to disallow the action when the user presses the button, or like @andrews said, cover the buttons with something.

---

<div class="post-metadata">

**Author:** ![lachguerabdallah](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lachguerabdallah/32/25558_2.png) [@lachguerabdallah](https://forum.inductiveautomation.com/u/lachguerabdallah)\
**Post date:** [October 30, 2023, 1:13pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038/4 "2023-10-30T13:13:31Z")

</div>

you can add scripts in OnCreateRoster and onDeleteRoster

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4e8afc37f83f67077347a39f777bb5cd7f6a0752.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:** [November 14, 2023, 2:18pm UTC](https://forum.inductiveautomation.com/t/disable-add-roster-button-in-the-roster-management/55038/5 "2023-11-14T14:18:07Z")

</div>

Since this post was resurrected, and it looked like an interesting thing to try, I developed a script that accesses the roster adding, editing, and deleting buttons, so they can be directly disabled or made invisible:

```auto
# Run from the Roster Manager's propertyChange event handler only once at initialization
# In the designer, preview mode must be running when the window is opened for this event to occur
if event.propertyName == 'componentRunning':

	# This is a recursive function that simply finds the roster table and retrieves its buttons
	def getRosterButtons(rosterManager):
		for component in rosterManager.getComponents():
			if '$RosterTable' in component. __class__. __name__ :
				return [subComponent for subComponent in component.getComponents() if 'JideButton' in subComponent. __class__. __name__]
			else:
				buttons = getRosterButtons(component)
				if buttons:
					return buttons
	
	# Get the roster buttons and unpack them into respective variables
	addRosterButton, editRosterButton, deleteRosterButton = getRosterButtons(event.source)
	
	# Disable the add roster button
	addRosterButton.enabled = False
	
	# The edit and delete buttons are automatically enabled whenever a roster is selected,
	# ...but they are not automatically made visible, so setting the visibility
	# ...to false effectively disables them
	editRosterButton.visible = False
	deleteRosterButton.visible = False

```

**Result:**  
_ **Before:** _  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/5/25aa994e5d8abf43ab33911eaeef397cf881d10a.png)

_ **After:** _  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4e47894a673c540dfd825c9762f53b11cb4d5871.png)
