Scripting API: Configuration & Assets

Part of the Scripting API reference.

Top-level namespaces for Jira administration (workflows, screens, schemes, roles) and JSM Assets (CMDB).

All configuration namespaces are injected as top-level variables - use WorkflowSchemes.list(), not Admin.WorkflowSchemes.list().


Configuration namespaces

Read-only namespaces

Namespace Description Methods
Workflows Workflow definitions list(), search(opts?), searchAll()
SecuritySchemes Issue security schemes list(), getLevel(id)
Events Jira events list()

Full CRUD namespaces (with pagination)

These namespaces support list(opts?), listAll(), get(id), create(data), update(id, data), delete(id):

Namespace Description
WorkflowSchemes Workflow schemes
Screens Screens (+ sub-resource methods below)
ScreenSchemes Screen schemes
IssueTypeSchemes Issue type schemes
IssueTypeScreenSchemes Issue type screen schemes
FieldConfigurations Field configurations (+ sub-resource methods below)
FieldConfigSchemes Field configuration schemes (+ sub-resource methods below)
NotificationSchemes Notification schemes
PrioritySchemes Priority schemes

Screens - additional methods for tabs and fields:

Method Description
Screens.getTabs(screenId) Get all tabs of a screen
Screens.getTabFields(screenId, tabId) Get fields of a screen tab
Screens.addField(screenId, tabId, fieldId) Add a field to a screen tab
Screens.removeField(screenId, tabId, fieldId) Remove a field from a screen tab

FieldConfigurations - additional methods for field items:

Method Description
FieldConfigurations.getFields(configId, opts?) Get fields in a configuration (all pages)
FieldConfigurations.updateFields(configId, data) Update field items in a configuration

FieldConfigSchemes - additional methods for mappings and projects:

Method Description
FieldConfigSchemes.getMappings(schemeId, opts?) Get field configuration mappings for a scheme (all pages)
FieldConfigSchemes.getProjects(projectIds, opts?) Get field config schemes for given project IDs (all pages)

Full CRUD namespaces (without pagination)

These namespaces support list(), get(id), create(data), update(id, data), delete(id):

Namespace Description
PermissionSchemes Permission schemes
Roles Project roles
ProjectCategories Project categories

Special namespaces

IssueTypes - Issue types:

Method Description
IssueTypes.list() List all issue types
IssueTypes.get(id) Get issue type by ID
IssueTypes.forProject(projectId) List issue types for a project (numeric project ID, sent as projectId - not the project key)
IssueTypes.create(data) Create an issue type
IssueTypes.update(id, data) Update an issue type
IssueTypes.delete(id) Delete an issue type

Statuses - Workflow statuses:

Method Description
Statuses.list(opts?) Search statuses, all pages (supports startAt, maxResults, searchString, projectId, expand)
Statuses.get(id) Get status by ID
Statuses.create(data) Create a status (data in body)
Statuses.update(data) Update a status (ID in data body, not as parameter)
Statuses.delete(id) Delete a status

Dashboards - Jira dashboards:

Method Description
Dashboards.list(opts?) List dashboards (paginated)
Dashboards.listAll() List all dashboards (auto-pagination)
Dashboards.get(id) Get dashboard by ID
Dashboards.search(opts?) Search dashboards (paginated)

Pagination

list(opts?) returns a single page. Use listAll() to automatically fetch all pages:

// Single page (default 50 items)
const page = Screens.list({ maxResults: 10 })

// All items (auto-pagination, up to 1000)
const all = Screens.listAll()

Methods accepting opts? support:

Option Type Description
maxResults number Maximum results per page
startAt number Starting index for pagination

Auto-pagination

listAll() and searchAll() methods automatically fetch all pages (up to 20 pages of 50 items each, max 1,000 items). They return a flat array of all results. Use these when you need the complete list without manual pagination.

list(opts?) stays single-page by design - it is the manual counterpart of listAll().

Sub-resource readers (Statuses.list, FieldConfigurations.getFields, FieldConfigSchemes.getMappings, FieldConfigSchemes.getProjects) have no listAll() twin, so they fetch every page themselves unless startAt/maxResults is passed - see List methods and pagination. Each page is one API call.

Examples

// List all workflow schemes
const schemes = WorkflowSchemes.list()
log(schemes.length)

// Get a specific screen
const screen = Screens.get('10001')
log(screen.name)

// Create a project role
const role = Roles.create({
  name: 'Release Manager',
  description: 'Manages releases'
})

// List issue types for a project (by project ID, not key)
const project = Projects.get('PROJ')
const types = IssueTypes.forProject(project.id)
for (const t of types) {
  log(t.name, t.id)
}

// Search dashboards
const dashboards = Dashboards.search({ maxResults: 10 })
for (const d of dashboards) {
  log(d.name)
}

// Search statuses by name
const statuses = Statuses.list({ searchString: 'Done', maxResults: 50 })
log(statuses.length)

// List all Jira events
const events = Events.list()
for (const e of events) {
  log(e.name)
}

// --- Auto-pagination (listAll / searchAll) ---

// Load all screens at once (up to 1000 items, 20 pages x 50)
const allScreens = Screens.listAll()
for (const s of allScreens) {
  log(s.id + ': ' + s.name)
}

// Same for any paginated CRUD namespace
const allConfigs = FieldConfigurations.listAll()
log('Total field configurations: ' + allConfigs.length)

// Workflows use searchAll() instead of listAll()
const allWorkflows = Workflows.searchAll()
log('Total workflows: ' + allWorkflows.length)

// Manual pagination: load one page at a time
const firstPage = Screens.list({ maxResults: 50, startAt: 0 })
const secondPage = Screens.list({ maxResults: 50, startAt: 50 })

// --- Screens sub-resources ---

// Get all tabs of a screen
const tabs = Screens.getTabs('10001')
for (const tab of tabs) {
  log(tab.id, tab.name)
}

// Add a field to the first tab
Screens.addField('10001', tabs[0].id, 'customfield_10100')

// List fields on a tab
const tabFields = Screens.getTabFields('10001', tabs[0].id)
for (const f of tabFields) {
  log(f.id, f.name)
}

// --- FieldConfigurations sub-resources ---

// Get fields in a field configuration
const items = FieldConfigurations.getFields('10001')
for (const item of items) {
  log(item.id)
}

// Update fields in a configuration
FieldConfigurations.updateFields('10001', {
  fieldConfigurationItems: [{ id: 'customfield_10100' }]
})

// --- FieldConfigSchemes sub-resources ---

// Get mappings for a scheme
const mappings = FieldConfigSchemes.getMappings('10001')
for (const m of mappings) {
  log(m.fieldConfigurationId, m.issueTypeId)
}

// Get schemes for projects
const projectSchemes = FieldConfigSchemes.getProjects(['10000', '10001'])
for (const s of projectSchemes) {
  log(s.projectId, s.fieldConfigurationSchemeId)
}

Assets namespace

Note: The Assets API requires Jira Service Management with Assets (CMDB) enabled on your Jira site.

The Assets namespace provides access to JSM Assets (CMDB) for managing objects, schemas, and object types.

Methods

Method Description API calls
Assets.search(aql, opts?) Search objects using AQL 1
Assets.getObject(id) Get object by ID 1
Assets.createObject(objectTypeId, attributes) Create a new object 1
Assets.updateObject(id, attributes) Update an object 1
Assets.deleteObject(id) Delete an object 1
Assets.getAttributes(objectId) Get object attributes 1
Assets.getObjectHistory(id) Get object change history 1
Assets.getConnectedTickets(id) Get Jira tickets linked to an object 1
Assets.getObjectReferenceInfo(id) Get objects referencing this object 1
Assets.getSchemas() List all schemas 1
Assets.getSchema(id) Get schema by ID 1
Assets.getObjectTypes(schemaId) List object types in a schema 1
Assets.getObjectType(id) Get object type by ID 1
Assets.getObjectTypeAttributes(id) Get attributes for an object type 1

Search options

Option Type Description
page number Page number
resultPerPage number Results per page
includeAttributes boolean Include attribute values
orderByTypeAttrId number Sort by attribute ID
asc number Sort direction (1 = ascending)

Examples

// Search for laptops
const result = Assets.search('objectType = "Laptop"', {
  resultPerPage: 50,
  includeAttributes: true
})
log(`Found ${result.objectEntries.length} laptops`)

// Get a specific object
const obj = Assets.getObject('123')
log(obj.label)

// Create an object
const newObj = Assets.createObject('15', [
  { objectTypeAttributeId: '100', objectAttributeValues: [{ value: 'My Laptop' }] },
  { objectTypeAttributeId: '101', objectAttributeValues: [{ value: 'Dell' }] }
])

// List schemas
const schemas = Assets.getSchemas()
for (const s of schemas.objectschemas) {
  log(s.name, s.id)
}

Next steps


JiBrok Studio for Jira Cloud JiBrok Studio for Jira Cloud
Release notes
Core Features
Triggers
Extensions
Data Storage
Scripting Overview
JavaScript Engine
Python Engine
Groovy Engine
Scripting API
Administration
Guides