I would like to split the process between the Create linked issue screen and the standard Create issue screen using Behaviour.
I have used the getFieldScreen() method.
However, both returned the same a Create issue screen name.
Is there a way to check whether the screen is the Create linked issue screen?
It's a hack, but I think this can be a solution:
I have noticed, that the field order is different between the create issue and the create linked issue forms, because the latter puts the issue link fields right after project and issue type before the summary.
Since the formContents are a LinkedHashMap, which preserves the order of its elements, I can use that information as a criterion in my behavior script:
(updated version)
def keys = getFormContents().keySet().toArray()What do you think?
if (behaviourContextId == "request-new-analysis") {
// coming from UI fragment by that name
log.warn("Create linked issue through UI fragment.")
} else if (keys.findIndexOf { it == "issueId" } < 0) {
// no issueId found: this seems to be a create screen
log.warn("create screen")
if (keys.findIndexOf { it == "summary" } < 0) {
// no summary field
log.warn("Create issue form w/o fields.")
} else if (keys.findIndexOf { it == "issuelinks" } < keys.findIndexOf { it == "summary" }) {
// issue links are before the summary
log.warn("Create linked issue form.")
} else {
log.warn("Create issue form with fields.")
}
} else {
// issueId is present: this is an edit, assign, or transition screen
log.warn("non-create screen")
}
What do I think, it asks? I think this is brilliant!
For this project the Create screen does not feature Linked Issues at all so the code is simple:
Breaks me loose solving the problem we are having, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I really tried to accomplish this, but as Scriptrunners webpage describes, there is no possible way of doing what you are asking. As you have found for yourself, it always just returns the create screen even when using getFieldScreen().
"Behaviours function on the Create Issue, Update/Edit Issue, Assign Issue, and Workflow Transition screens.
On the View Issue screen, trying to edit a field with a behaviour launches the Edit Issue screen, instead of the normal inline editor.
Behaviours do not work on the Move Issue screen. They also do not work for any bulk issue operations, or any issue edits that bypass the UI such as the REST API and other ScriptRunner scripts."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Mathis Hellensberg
Thank you for your answer.
As you said, I found the description on the following page.
https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#_screens
As I thought, it seems impossible...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@DOBA Shuzaburo [Ricksoft] Please accept my answer so others might find it :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Test Comment
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.