- Overview
- Capabilities
- Setting up
- Callback types
- Examples
- Admin management
- Important notes
- Next steps
Overview
UI Modifications (UIM) let you dynamically customize the Jira issue create form and the JSM portal request create form using scripts. React to form events in real time to show/hide fields, set values, change requirements, and more.
What UIM can do:
- Change field names and descriptions
- Show or hide fields
- Set fields as required or optional
- Set fields as read-only
- Set field values programmatically
- Show or hide options in select fields
- React to field changes in real time
Capabilities
| Method | Description |
|---|---|
uim.setValue(fieldId, value) |
Set a field’s value programmatically |
uim.setVisible(fieldId, boolean) |
Show or hide a field |
uim.setRequired(fieldId, boolean) |
Set a field as required or optional |
uim.setReadOnly(fieldId, boolean) |
Set a field as read-only |
uim.setName(fieldId, name) |
Change a field’s display name |
uim.setDescription(fieldId, text) |
Set a field’s description text |
uim.setOptionsVisibility(fieldId, options, boolean) |
Show or hide specific options in a select field |
Convenience aliases
| Alias | Equivalent to |
|---|---|
uim.setFieldName(fieldId, name) |
uim.setName(fieldId, name) |
uim.setFieldDescription(fieldId, desc) |
uim.setDescription(fieldId, desc) |
uim.setFieldValue(fieldId, value) |
uim.setValue(fieldId, value) |
uim.hideField(fieldId) |
uim.setVisible(fieldId, false) |
uim.showField(fieldId) |
uim.setVisible(fieldId, true) |
Setting up
- Make sure the UI Modification trigger type is enabled in Administration (Admin Panel -> Admin -> Triggers) - it is disabled by default
- Create a script with UIM logic
- Add a UI Modification trigger in the script’s Config tab
- On the script’s Context tab, choose the projects and issue types, and/or the JSM service desks and request types, and the fields to target
- Save the script - the app registers the UI modification in Jira for the selected scope
The trigger has no settings of its own; everything is configured on the Context tab. One UIM trigger per script (singleton).
UIM scope (Context tab)
| Setting | Description |
|---|---|
| Projects | Projects whose Issue Create form the script modifies |
| Issue Types | Issue types within those projects |
| Service Desks (Portals) | JSM portals whose Request Create form the script modifies |
| Request Types | Request types within those portals |
| Fields | Fields the script monitors and modifies |
A UI modification is registered for every selected project and issue type combination, and for every selected portal and request type combination. Select at least one issue type (or request type): a project or portal with no issue types (or request types) selected gets no registration, so the script does not run on its form.
When the script runs
- onInit - when the form opens
- onChange - when one of the selected fields changes
Both callbacks run the same script. Use uimData.callbackType ("onInit" or "onChange") to tell them apart, and uimData.changedFieldId / uimData.changedValue to see what changed.
Callback types
onInit
Fires when the form opens. Use this to set initial field states:
if (uimData.callbackType === 'onInit') {
uim.setName("summary", "Brief Description")
uim.setVisible("description", false)
uim.setRequired("priority", true)
}
onChange
Fires when one of the selected fields changes. Use this to react dynamically:
// React to field changes
if (uimData.changedFieldId === "priority" && uimData.changedValue === "Critical") {
uim.showField("duedate")
uim.setRequired("duedate", true)
}
if (uimData.changedFieldId === 'priority') {
let priority = uimData.fieldValues?.priority?.value
if (priority === 'Highest' || priority === 'High') {
uim.setVisible('duedate', true)
uim.setRequired('duedate', true)
uim.setDescription('duedate', 'Due date is required for high priority issues')
} else {
uim.setRequired('duedate', false)
uim.setDescription('duedate', '')
}
}
Examples
Conditional required fields
if (uimData.callbackType === 'onInit' || uimData.changedFieldId === 'priority') {
let priority = uimData.fieldValues?.priority?.value
if (priority === 'Highest' || priority === 'High') {
uim.setRequired('duedate', true)
} else {
uim.setRequired('duedate', false)
}
}
Show/hide fields by issue type
if (uimData.callbackType === 'onInit' || uimData.changedFieldId === 'issuetype') {
let type = uimData.fieldValues?.issuetype?.value
if (type === 'Bug') {
uim.setVisible('environment', true)
uim.setVisible('customfield_10100', true) // Steps to reproduce
} else {
uim.setVisible('environment', false)
uim.setVisible('customfield_10100', false)
}
}
Auto-fill fields on create
if (uimData.callbackType === 'onInit' && uimData.viewType === 'GIC') {
let user = Users.current()
uim.setValue('reporter', { accountId: user.accountId })
// Set default due date to 2 weeks from now
let due = DateUtils.addDays(new Date(), 14)
uim.setValue('duedate', DateUtils.format(due, 'YYYY-MM-DD'))
}
Admin management
Admin Panel -> Admin -> UIM shows how many UI modifications are registered in Jira for Jira projects and for JSM service desks - for example 5 UIMs in Jira (1 UIM in Jira for one) - and lets you:
- Re-register All UIMs - register every UIM script again from its saved scope
- Delete Jira UIMs or Delete JSM UIMs - remove the registrations of one context
- Delete All UIMs - remove every registration
Bulk delete with an incomplete list. Studio reads the UIM list page by page to the end (up to 40 pages of 50). If Jira does not return every UIM (the limit is reached or a page fails midway), Delete All UIMs deletes only the UIMs it read and reports: “Deleted N UIM(s), but Jira did not return every UIM, so some may remain. Run the deletion again.” Run the deletion again until no UIMs remain.
Important notes
- UIM scripts always run as current user
- Limits per run: 5 seconds execution, 20 API calls, 20 pending promises (see Limits)
- UIM is registered per project/issue type and per portal/request type combination
- Trigger parameters are not passed to UIM scripts
- Multiple UIM scripts on the same form may conflict
- Keep UIM scripts fast and simple for best performance
Next steps
- Triggers - UIM trigger configuration details
- UIM API - All available UIM scripting methods
- Scripting Language - Language and API reference
- Administration - UIM registration management
