Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

129 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you