# Roster Management - best way to run a script on changes to rosters

**URL:** <https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 14, 2020, 4:38pm UTC](https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280 "2020-02-14T16:38:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpavlicek](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rpavlicek/32/55868_2.png) [@rpavlicek](https://forum.inductiveautomation.com/u/rpavlicek)\
**Post date:** [February 14, 2020, 4:38pm UTC](https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280/1 "2020-02-14T16:38:48Z")

</div>

We are using a script that uses the system.alarm.getRosters function to pull out the users in each roster and put it in a dataset memory tag which we want updated every time a change is made. The dataset memory tag is then used elsewhere.

The problem I’m having is finding out the most efficient way to trigger the script which writes to the dataset memory tag. I tried using the Roster management extension function “onSaveRoster”, but after making a change to a roster, it first runs the script with the old roster, then saves the new changes. So the dataset memory tag is outdated unless I go in and do a save again (with no changes) which picks up the change from the first time.

The Roster Management doesn’t have any built in properties that change, so the best I thought of is making a custom method of type date, and run an expression of now(5000) for example to run periodically, but that means it would be running the script needlessly at times. Any better way to do this? Thanks

---

<div class="post-metadata">

**Author:** ![rpavlicek](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rpavlicek/32/55868_2.png) [@rpavlicek](https://forum.inductiveautomation.com/u/rpavlicek)\
**Post date:** [February 14, 2020, 5:12pm UTC](https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280/2 "2020-02-14T17:12:55Z")

</div>

So shortly after posting this, I may have come up with something. I put in a **delay** to the system.util.invokeLater and it does seem to work now.

For example, on the Roster Management component , I created a custom method with the script to write to the dataset memory tag (uses system.alarm.getRosters and such). On the “onSaveRoster” extension, I put system.util.invokeLater(self.newMethod, 5000).

Without the delay argument, the invokeLater didn’t work (race condition?)

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [February 14, 2020, 5:35pm UTC](https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280/3 "2020-02-14T17:35:00Z")

</div>

We ran into issues like this and scrapped the idea of using Ignitions built in roster and created our own tables, screens, etc. We then use calculated rosters. It obviously takes a little more time to get going but it is more robust and configurable.

---

<div class="post-metadata">

**Author:** ![Ricahrd\_Michael\_Sali](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@Ricahrd\_Michael\_Sali](https://forum.inductiveautomation.com/u/Ricahrd_Michael_Sali)\
**Post date:** [April 13, 2023, 7:26pm UTC](https://forum.inductiveautomation.com/t/roster-management-best-way-to-run-a-script-on-changes-to-rosters/32280/4 "2023-04-13T19:26:38Z")

</div>

> [@rpavlicek](#):
>
> We are using a script that uses the system.alarm.getRosters function to pull out the users in each roster and put it in a dataset memory tag which we want updated every time a change is made. The dataset memory tag is then used elsewhere.

I'm trying to do the same in Ver. 8.1.  
Would you still happen to have the script you used in your custom method?
