Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can ScriptRunner Behaviours control field visibility (show/hide) on Jira Service Management portal?

Akshad Katke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 20, 2026

Hi everyone,

I am working on a Jira Service Management (Data Center) project and trying to implement dynamic field behavior on the customer portal (Help Center).

🔹 Requirement:

I have three fields:

  • Service Type (Assets field)
  • Service (Assets field)
  • Sub-Service (Assets field)

I want to achieve the following behavior on the portal form:

  • If Service = "Business Application and Operation" → Show Sub-Service
  • For all other Service values → Hide Sub-Service

🔹 What I have tried:

  • Configured ScriptRunner Behaviours
  • Added Service Desk mapping
  • Used setHidden() and setRequired() in both:
    • Initialiser
    • Server-side script on Service field

The behavior works on the Jira create/edit screen, but on the portal, the Sub-Service field is still visible.

🔹 Current workaround:

I have implemented Assets AQL filtering, which works fine for filtering values, but it does not hide the field completely.

🔹 Question:

Is it possible to dynamically show/hide fields on the JSM portal using ScriptRunner Behaviours, especially for Assets fields?

If not, what is the recommended approach to achieve this requirement?

🔹 Environment:

  • Jira Service Management (Data Center)
  • ScriptRunner for Jira
  • Assets (Insight) object fields

Any guidance or best practices would be really helpful.

Thanks in advance!

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Marc -Devoteam-
Community Champion
April 20, 2026

Hi @Akshad Katke 

Yes, you can.

You probably need an AQL clause in the script.

Can you provide your script and pinpoint the problem in it?

Akshad Katke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 20, 2026

Hi,

Thank you for your response.

Yes, these are Assets (Insight) object fields, not standard fields.

Field IDs

  • Service Type = customfield_11500

  • Service = customfield_11501

  • Sub-Service = customfield_11502

Requirement

  • Show Sub-Service only when Service is:

    • Business Application and Operation

    • IT & CS

  • Hide Sub-Service for all other Service values

Current Script (used in Initialiser and Service field Behaviour)

def serviceField = getFieldById("customfield_11501")
def subServiceField = getFieldById("customfield_11502")

def serviceValue = serviceField.getValue()

def shouldShow = false
def selectedService = ""

if (serviceValue) {
    selectedService = serviceValue.toString().trim().toLowerCase()

    if (selectedService.contains("business application and operation") ||
        selectedService.contains("it & cs")) {
        shouldShow = true
    }
}

subServiceField.setHidden(!shouldShow)
subServiceField.setRequired(shouldShow)

if (!shouldShow) {
    subServiceField.setFormValue(null)
}

Problem
This works correctly on the Jira create/edit screen, but on the customer portal the Sub-Service field (Assets object field) still remains visible.

We are already using AQL filtering, which works fine for restricting Sub-Service values based on the selected Service. However, the field itself is not getting hidden on the portal.

If you have any example of using AQL within ScriptRunner Behaviour for Assets fields on the portal, or if there are known limitations for hiding Assets object fields on the JSM portal, please let me know.

Thank you.

Marc -Devoteam-
Community Champion
April 20, 2026

Hi @Akshad Katke 

Is the sub-service field set to mandatory in the Request Type config?

This should be on "No"

If it's mandatory, it should be set in the behaviour

Akshad Katke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 20, 2026

Hi,

Yes, the Sub-Service field is set to optional (not mandatory) in the Request Type configuration.

We are controlling the mandatory condition dynamically through ScriptRunner Behaviour using setRequired(true/false) based on the selected Service.

However, the main issue we are facing is not related to mandatory behavior — it is about hiding the Sub-Service field completely on the customer portal when it is not required.

Even with the field set as optional in the Request Type and handled via Behaviour, the field is still visible on the portal.

Please let me know if there are any additional configurations required specifically for Assets object fields on the portal.

Thank you.

Marc -Devoteam-
Community Champion
April 20, 2026

Hi @Akshad Katke 

It might be due to the contains option.

What if you use:

(selectedService == "business application and operation" ||
        selectedService == "it & cs")
0 votes
Nikola Perisic
Community Champion
April 20, 2026

Hello @Akshad Katke 

Have you tried with the Assets AQL and also the dynamic forms that you can create in your service management space? It's easier and does the most of the heavy lifting.

To create a dynamic form, add a section where you should also be having the logic. You can add unlimited number of sections. 

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events