Forums

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

Where does a Scriptrunner UI fragment need to run for the issue creation screen?

Midya Rahmani April 25, 2024

I've created some Javascript code and I'm trying to create a Scriptrunner UI fragment. Under the "Context(s)" option, I'm unsure which one to select. I need my javascript UI fragment to run on the issue creation screen. Here's the section I'm referring to:
Screenshot 2024-04-25 at 8.28.06 AM.png

2 answers

1 accepted

3 votes
Answer accepted
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2024

Hi @Midya Rahmani Welcome to Atlassian Community!

It is not possible to use Script Fragments on the Create Screen.

You can use Scriptrunner Behaviour for create issue screen.

 

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2024

@Ram Kumar Aravindakshan _Adaptavist_  Do you have any suggestion or workaround to add Script fragment on create issue screen ?

Midya Rahmani April 25, 2024

@Vikrant Yadav Thanks for the reply. I tried to create a behaviour for this in Jira DC, however I ran into some issues. I wasn't able to create a behaviour for the create issue screen that could hide certain drop down values on a single select drop down custom field depending on a selected component. Do you know if this is possible with behaviours?

Midya Rahmani April 25, 2024

@Vikrant Yadav Thanks for your answer, I was able to figure it out using the following behaviour:

import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.onresolve.jira.groovy.user.FieldBehaviours.getFieldById
import com.atlassian.jira.component.ComponentAccessor

def componentsField = getFieldById("components")
def affectedAreaField = getFieldById("customfield_10200")
def selectedComponents = componentsField.getValue() as List<Map<String, Object>>
def isApplicationSelected = selectedComponents.any { it["name"] == "Application" }
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def affectedAreaCustomField = customFieldManager.getCustomFieldObject("customfield_10200")
def config = affectedAreaCustomField.getRelevantConfig(issueContext)
def options = optionsManager.getOptions(config)

if (isApplicationSelected) {
// Filter the options, retaining only "Administration" and "Authoring"

def
allowedOptions = options.findAll {
it.value in ["Administration", "Authoring"]
}
affectedAreaField.setFieldOptions(allowedOptions)
} else {

// If "Application" is not selected, show all options
affectedAreaField.setFieldOptions(options)

}
Like # people like this
0 votes
Nic Brough -Adaptavist-
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 Leaders.
April 25, 2024

Welcome to the Atlassian Community!

The easiest way to work this out is to use the fragment finder in SR.  See https://docs.adaptavist.com/sr4js/latest/features/fragments for how to find and use it

Improving the language and layout of fragments, including making the fragment finder easier to find and use is something we have in progress at the moment.

Midya Rahmani April 25, 2024

Thanks for your response Nic, I tried enabling the fragment locator, however it unfortunately doesn't seem to show anything for the issue creation screen:

Screenshot 2024-04-25 at 8.47.54 AM.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events