Quick question - is it possible to control Create Issue Screen by Scriptrunner behaviours on - prem like this:
I'm creating an issue from within epic
I'd like to have some values (summary for example) prepopulated from the epic
Just like forms on Service Management where by script we can prefill some values
I generally like to examine the call from my developer panel.
Specifically, when your Create Issue in Epic screen loads, you should see a call to /rest/scriptrunner/behaviours/latest/validatorsByPid.json.
If you examine the outgoing payload, that will give you a clue as to what information your initialiser script will have access to.
Unfortunately, you will see that at the moment, scriptrunner doesn't send what will ultimately be added to the "Epic Link" field unless that field is listed on your screen.
So, if you want a behaviour that's based on the parent epic you have to add the Epic Link to your create screen.
Then, you will see that the parent epic is available as part of the customfield in the payload.
So that means we can write a script with it, but strangely, the value include the prefix "key:". So we'll need to be a little creative.
Here is a snippet that will set the new issue's summary to same as the parent epic, adjust as needed:
if(underlyingIssue) return //don't default values during subsequent edits
def sumFld = getFieldById('summary')
def epicFld = getFieldByName('Epic Link')
if(!epicFld.value) return //there is no value in the Epic Link field or it was not included in the screen
//extract the key from "key:ABC-123"
def epicKey = (epicFld.value as String).tokenize(':')[1]
//get an issue object
def epicIssue= Issues.getByKey(epicKey)
//do the behaviour actions needed
sumFld.setFormValue(epicIssue.summary)
And that's a great place to start, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.