Page tree
Skip to end of metadata
Go to start of metadata

Tracking access time for structures only become available with Structure 8.2. This means the earliest tracking available occurs shortly after the first upgrade to 8.2 or higher. If a structure hasn't been accessed since that update, it is considered never accessed.


import java.time.Duration
import com.almworks.jira.structure.api.StructureComponents
import com.almworks.jira.structure.api.permissions.PermissionLevel
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin

@WithPlugin("com.almworks.jira.structure")
@PluginModule
StructureComponents sc
def sm = sc.getStructureManager()
def sps = sc.getStructurePropertyService()
def currentTime = System.currentTimeMillis()
def structures = sm.getAllStructures(PermissionLevel.VIEW)
structures.findAll { structure ->
    def lastPolledMillis = sps.getLong(structure.id, "lastPolledMillis", 0)
    return Duration.ofMillis(currentTime - lastPolledMillis).toDays() > 90
}

  • No labels