Skip to main content
Skip table of contents

List Structures That Haven’t Been Accessed in 3 Months without Archiving Them

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

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(, "lastPolledMillis", 0)
    return Duration.ofMillis(currentTime - lastPolledMillis).toDays() > 90

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.