Forums

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

Create a set of new issues on different projects

Gabriel MOSCALU May 5, 2018

Hi,

 

I need a bit of help in creating a workflow for multitenant platform support (one platform that runs apps for multiple clients). Each client has a dedicated project in JIRA and will access the issues from ServiceDesk Customer Portal.

 

The tech team will enter the list of projects keys in a CF textfield called "Affected projects", and based on this, i need to create issues in the corresponding projects, copying data from the initial DC issue. Since this is needed for different projects, I cannot simply clone the initial issue :( (as in https://community.atlassian.com/t5/Marketplace-Apps-questions/how-to-clone-a-Jira-issue-multiple-times-based-on-the-Jira-issue/qaq-p/385201) 

 

Optionally, by using a Project selector drop-down & SR Behaviors, i would like to copy the project key from drop-down to project list (and make the list unique) in a screen before triggering the transition (scope being that tech team validates the impact & affected projects before triggering the transition)...

 

What i tested was to create a bash/shell script that creates the issue via API (and call it from the workflow in a similar way we call a Python script to send SMS notifications) which seem to work, but i'd like to do this in a workflow transition via ScriptRunner (or why not, JMWE, but SR seems more appropriate).

 

Any other ideas or code snippets to help me with this?

 

Env:

- JIRA Software 7.3.6 (500 users)

- JIRA ServiceDesk 3.5.0 (500 agents)

- Script Runner 5.2.2

- JMWE 5.0.3

 

Thanks,

Gabriel

2 answers

0 votes
Normann P. Nielsen (Netic)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2018

Hi,

The link does not Work. I think - straight from the keyboard I would make a transition for each of the "Affected projects" and In that one, do some:

* Clone to Project X

* Possible close the source issue

The create a (groovy) Listener listening on "Issue Updated" or "Issue Created" that fires:

* "Affected projects" is changed and such - I suppose the cloning must only happend one time(!)

* Fires the correct Transition, possible as an Automation User (the Transitions can then be hidden for all other users)

* Possible sets a field as a flag that states the cloning has been done once.

 

Or in the "Affected projects" is changed and such part - You can check if there is a link to a clone of the issue.

 

Transition is something like:

 

// Transist Issue        
workflowTransitionUtil.setIssue(event.issue)       
workflowTransitionUtil.setUsername(currentuser) 
workflowTransitionUtil.setAction (transition)       

// Validate and transition issue
workflowTransitionUtil.validate()
workflowTransitionUtil.progress()
status = event.issue.getStatusObject().getName()        

System.out.println("script=Listener.groovy IssueKey=" + issuekey + " Issue " + issueid + " transited to new status: " + status)

 

PS: I have tried to program my own Clone groovy stuff routine once - took a long time and was difficult to maintain, hence I tend to use buildin/plugin stuff instead.

And for each new possible value in the "Affected projects" - You only need to add a transition with a few steps.

Gabriel MOSCALU May 7, 2018

Hi Normann,

 

The problem is that I need things to be dynamic.

 

We have multi-tenant platforms holding 3-4 customers and platforms holding 50+ customers. And if the entire DC will be down, or we're applying a change on the DC  WAN equipment, it means ~300 projects... Having a workflow with 300 transitions between State A and State B will be a nightmare to both implement & maintain afterwards. 

 

That is why, in a multi-line text field, I am trying to capture the list of project keys, to loop though that and do things within a single transition...

0 votes
David Fischer
Community Champion
May 5, 2018

Hi Gabriel,

the next version of JMWE, due later this month, includes an improvement to the Create Issue post-function that allows you to create multiple issues at once, and their project can be “calculated” exactly the way you need it. All with almost zero code. 

If you’re interested in a snapshot version, simply raise a support request at https://innovalog.atlassian.net/servicedesk/customer/portal/8

Gabriel MOSCALU May 5, 2018

Hi David, That's excellent news.

 

Just let me know if i can have that snapshot version before our JMWE M&S renewal is completed (already ongoing with our purchasing)

David Fischer
Community Champion
May 5, 2018

We don't control licensing, but you can get a Trial license, and if you choose to later revert to your current JMWE version, you'll just need to reapply your current paid license (which you can find on your my.atlassian.com account, or you can save it from the Maange add-ons page).

Of course, in exchange for the snapshot version, you'll need to accept the fact that this version hasn't yet fully gone through our QA process. And you'll need to be willing to give us feedback on the new feature :)

Gabriel MOSCALU June 27, 2018

Hi David,

I got the new version - is there any knowledgebase article explaining how to use it, because i have the feeling from the GUI it's not what i need...

It looks like it is requiring a single project, while I have a comma separated list of projects and it can create multiple issues within a single project; while I need one issue per multiple projects... Am I wrong ?

 

Thanks

Gabriel

David Fischer
Community Champion
June 27, 2018

Hi Gabriel,

I'll look into it and get back to you shortly. 

David Fischer
Community Champion
June 27, 2018

Hi Gabriel,

if each created issue will belong to a different project, it means that the project is "calculated". If you select "Calculated" under "Project", you'll be able to input a Groovy Script that will return a valid project key. So, if the only difference between the issues that are created by the post-function is the project, your "Iterator" will be just a list of project keys. Something like ["PROJA","PROJB"]. And then the "current" project key will be in the "it" variable, so your Calculated Project Groovy script will be as simple as...

it

Hope this helps,

David

Falk Eckert January 8, 2019

Hello

is it possible to clone one issue to multiple Projects with the Post Funktion from the JMWE Plugin?

Thanks

David Fischer
Community Champion
January 8, 2019

Absolutely, using the "multiple issue creation" option, together with a "Calculated" value for the destination project. You can find more details on how this option works in the "Expected Value" help tab of the multiple issue creation iterator option.

This is exactly what Gabriel wanted to do above.

Falk Eckert January 9, 2019

Hello David thanks for your fast reply,

I tried but it does not work.

I,m getting an error if i use only "it" in "calculated"project field.

Multible Issues im getting the values from an custom field of that issue

Thanks

David Fischer
Community Champion
January 9, 2019

If you are iterating over the values of a multi-select custom field, then {{it}} will be an Option object. In that case, use {{it.value}}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events