Losing my mind a little bit. I made a new web fragment that displays on: alt.jira.view.right.context
For the condition, I automatically have access to JiraHelper and Issue classes/variables. Works fine...
For the "Provider class/script" portion, I dont have either of those. I am trying to get the issues Assignee Email address, Reporter, email address, key, and a few other items.
Most things I see online say to:
(Sorry dont know how to submit a comment block)
import com.atlassian.jira.issue
- OR -
import com.atlassian.jira.issue.Issue
but these don't work and I get an "Import is never referenced".
So I tried:
This worked. Although I had the hardest time finding out "context" and how to use it. I also had trouble finding the correct libraries to import, so I used
import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
def issue = context.issue as Issue
def issueAssignee = issue.assignee?.getEmailAddress().toString()
def issueReporter = issue.reporter?.getEmailAddress().toString()
def issueReporterName = issue.reporter.getDisplayName().toString().split(', ')
def issueAssigneeName = issue.assignee.getDisplayName().toString().split(', ')
def issueKey = issue.getKey().toString()
def firstNameR = issueReporterName[1]
def lastNameR = issueReporterName[0]
def userNameR = issue.reporter.getUsername()
def firstNameA = issueAssigneeName[1]
def lastNameA = issueAssigneeName[0]
def userNameA = issue.assignee.getUsername()
Are you using a custom web item?
This need to trigger an URL which could be a REST endpoint in ScriptRunner. It is possible to use variables in the actual configured URL like:
https://myjira.foo.bar/rest/scriptrunner/latest/custom/foobar?issueKey=${issue.key}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
leaving the java api to have to hit/authenticate to a http restApi seems excessive.
I found a much easier way in the java API. However I had a REALLY hard time finding the "context" variable and it's methods used in a fragment and how to use it. I went through dozens of posts and found one with it referenced...
I had to use a wildcard here, because I couldnt find the correct combination of imports. But it worked...
import com.atlassian.jira.issue.*
This ultimately worked fine... I needed variables from the reporter and the assignee to do some other customizations. This is how I snagged them:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.*
def issue = context.issue as Issue
def issueAssignee = issue.assignee?.getEmailAddress().toString()
def issueReporter = issue.reporter?.getEmailAddress().toString()
def issueReporterName = issue.reporter.getDisplayName().toString().split(', ')
def issueAssigneeName = issue.assignee.getDisplayName().toString().split(', ')
def issueKey = issue.getKey().toString()
def firstNameR = issueReporterName[1]
def lastNameR = issueReporterName[0]
def userNameR = issue.reporter.getUsername()
def firstNameA = issueAssigneeName[1]
def lastNameA = issueAssigneeName[0]
def userNameA = issue.assignee.getUsername()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Wesley Stewart ,
How do you display these values on the web panel? I tried the ${variable_name} in the writer.write function but it doesn't display anything..
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.