Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i run my own created java code in the background, when any issue is created?

kaushtuv nayan May 7, 2018

I have a requirement of creating a java plugin for jira, which will create a in-code defined custom field with other changes, whenever an issue is created for a jira instance.

Logically i was thinking this will be a kind of add-on which will be somehow added to the instance such that, when any issue is created that addon will run in background and will create a custom field.

Please help me with this.
Thanks

1 answer

2 votes
Tuncay Senturk _Snapbytes_
Community Champion
May 7, 2018

Hello,

You should write your own plugin which will have issue listener which will listen "issue created" events. In the listener, you can create customfield. You can ping me if you need details.

However, this is not a good usage though. I mean, why do you need to create a custom field whenever an issue is raised?

kaushtuv nayan May 7, 2018

We need this custom file as a text field where we will keep track of feature file used by cucumber framework. Also, this file has to be linked with `git` , if any changes made to the feature file it should reflect in jira.

Tuncay Senturk _Snapbytes_
Community Champion
May 7, 2018

Ok, I see.

However, you do not need multiple custom fields. How about this:

  • Create a custom field (type: text area) called BDD Scenario
  • Type your scenarios in this field 
  • In git hook you can update issue's custom field with the new scenario via REST service

Am I missing something?

kaushtuv nayan May 8, 2018

Thanks Santurk For your reply.

But i am a developer for the organization, and have to make life easy for the tester's. Many don't have permission to create the custom field.

But your git hook idea seems nice.

Tuncay Senturk _Snapbytes_
Community Champion
May 8, 2018

Nobody will create custom fields. Jira Admin will create the custom field once, every issue will use this custom field. Testers won't create custom field, they will update the content of the field. And git hook as well

kaushtuv nayan May 10, 2018

Thanks for answer.
I think this will do my work.

But how to connect the custom field to git. Do you have some documentation or example to look into will be very helpful. I have to create this plugin for jira server and later for jira cloud.

Tuncay Senturk _Snapbytes_
Community Champion
May 10, 2018

Whenever you have update with the feature (git hook), then you will call a JIRA REST service to update the custom field.

You can update custom field by editing issue REST API. Below is an example of json body

{
    "fields" : {
        "customfield_10200" : {"value" : "Feature content here"}
    }
}

Here are details of REST service

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#editing-an-issue-examples

Suggest an answer

Log in or Sign up to answer