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).
I have three fields:
I want to achieve the following behavior on the portal form:
setHidden() and setRequired() in both:
The behavior works on the Jira create/edit screen, but on the portal, the Sub-Service field is still visible.
I have implemented Assets AQL filtering, which works fine for filtering values, but it does not hide the field completely.
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?
Any guidance or best practices would be really helpful.
Thanks in advance!
Yes, you can.
You probably need an AQL clause in the script.
Can you provide your script and pinpoint the problem in it?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It might be due to the contains option.
What if you use:
(selectedService == "business application and operation" ||
selectedService == "it & cs")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.