Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Accessing Origin Field of an Issue

Adam Pitcher May 26, 2021

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

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 27, 2021

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

1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2021

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
}
Adam Pitcher May 26, 2021

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.


TAGS
AUG Leaders

Atlassian Community Events