Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,365,088
Community Members
 
Community Events
168
Community Groups

Accessing Origin Field of an Issue

I am not 100% how to ask this, or if this is the right place, but here is my situation.

I have been tasked with generating a report grouping the origins of tasks.

I see the field "Origin", and it is available as a column when I do searches.  However, when I access the issue via rest API - Origin nor it's ID is available.   Also, when added as a column in the search results it is empty.

Now, when I view an issue.   At the top is a nice little blurb that says - So and so raised this request via Portal/Jira/Email - which to me would be the Origin?!?!?!

How do I get that value programmatically - any ideas?   I am trying to do this all through scriptrunner,  but I can't seem to get that value anywhere - even though I can see it exists.  Is it a different field/id than Origin?

If this is the wrong place please accept my apologies and point me to the right location =)

2 answers

1 accepted

0 votes
Answer accepted

Hi Adam,

I have checked and it is not possible to access the Channel field which shows where an issue originated from inside of Jira Cloud due to the fact that Atlassian does not provide any public Rest API's to access this information.

ScriptRunner for Jira Cloud can only return information from Jira using the Rest API's that Atlassian provides and as Atlassian does not provide any API's to access this information in Jira Cloud then you will be unabe to access this information in your script.

I hope this information helps.

Regards,

Kristian

0 votes

Are you talking Server/DC or Cloud

I wonder where you see this "Origin" field in searches.

I have a "Channel" field visible on JSM issue view which can contain the values or Jira, Portal or Email. Maybe on cloud it's called Origin?

In my server case, "Channel" is a JSM issue property, not an actual field.

You should be able to get that with https://docs.atlassian.com/software/jira/docs/api/REST/8.5.15/#api/2/issue/{issueIdOrKey}/properties

Or in scriptrunner, 

import com.atlassian.jira.bc.issue.properties.IssuePropertyService
import com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper

def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issuePropertyService = ComponentAccessor.getComponent(IssuePropertyService)
def issue=ComponentAccessor.issueManager.getIssueObject('XXX-NNN')

def prop = issuePropertyService.getProperty(currentUser, issue.id, 'request.channel.type')
if(prop && prop.isValid() && prop.entityProperty.isDefined() ){
    (new JsonSlurper().parseText(prop.entityProperty.value.value as String) as Map).value
}

Sorry, it is Jira Cloud - so using Scriptrunner for Jira Cloud, which means I (as I understand it) don't have the ability to code it up in Java but rather Groovy leveraging the Rest endpoints.

The Origin field is (for me at least) found in the list of fields available to an issue, and when I do the search it is an available column to display - however, it is empty for all results.

I will check if Channel is an option, that may be what I need.


Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events