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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to differentiate between creating issue via rest versus creating issue via clone

Hello,

 

I have a script in workflow 'issue create' that checks if issue created manually or by clone:

def request = ActionContext.getRequest()
if (request)

{ log.warn "The issue created manually" return }

//clone issue
else

{ log.warn "The issue came from a clone action" }

I figured that if issue created by REST, the script returns 'null' like issue clone,
and I have to seperate those two option for creation.

How can I differentiate between creating issue via rest versus creating issue via clone using groovy script?

We would like do delete some copied field's values when the user clone an issue.
In REST issue we dont want to delete these fields's values.

 

Thank you,
Daniel

1 answer

Hi @Dan27 , I do not think it is possible to check the way the issue was created in create transition.

But what about to try to use logic which will contain the rule that cloned issue is always linked with source issue with specific type of link by default? So you can

  1. implement listener to issue created event
  2. check the links on the created issue
  3. clear values if link of specific type is created on the issue

Hi @Martin Bayer _MoroSystems_ s_r_o__ ,

Thank you for your answer.

In issue created event listener, you can't find the links of the issue yet, I already tried it..

hm ok @Dan27 so what about to use https://docs.atlassian.com/software/jira/docs/api/7.6.0/com/atlassian/jira/event/issue/link/IssueLinkCreatedEvent.html?

I think clones link is not created manually often so it may be the basic filter...or you Can add check that for example timespan between issue was created and link was created is lower than 5s...

Thanks @Martin Bayer _MoroSystems_ s_r_o__ ,

It has the same problem, in issue creation, the link didn't exists...

Hi @Dan27 you have all needed information in IssueLinkCreatedEvent object. You can get issue link using getIssueLink() method and it contains sourceObjectdestinationObject and issueLinkType (https://docs.atlassian.com/software/jira/docs/api/7.6.0/com/atlassian/jira/issue/link/IssueLink.html)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

149 views 3 7
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