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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,459,606
Community Members
 
Community Events
176
Community Groups

How to get issue's 'request.channel.type' property with jira api

Hi All,

    I want to get an issue's 'request.channel.type' property to judge which way created issue with jira api, I know the jira rest api can help me do it, and I tried use following way to do it in scriptrunner

ComponentAccessor.getComponent(JsonEntityPropertyManager.class).get("IssueProperty",issueId).get("request.channel.type")

this way only be useful for issue that I have created, but I need to judge it when I get issue create event, so anyone can help me ? Thanks!

1 answer

Hello @Mack Chen

Try this

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-1")

IssuePropertyService issuePropertyService = ComponentAccessor.getComponentOfType(IssuePropertyService.class)
def entityProperty = issuePropertyService.getProperty(user, issue.id, "request.channel.type").getEntityProperty()

Thanks @Mark Markov, I tried this way, and the result is the same as the way I have showed, it's useful for issue that I have created, when issue create event trigger my groovy, I want to get this issue's 'request.channel.type'

The thing is that this property filling after ISSUE_CREATED event. This is how service desk api works.

As workaround, you can create listener on ISSUE_UPDATED event and catch whenever this field gets value.

@Mark Markov the code works perfect!!! Thanks,

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events