Hi
I have a Jira automation that creates a number of new tasks in a different project and links them back to the original issue. It clones the data into the new project, as shown in the partial screenshot:
This solution has 2 problems:
It only works up to 14 or so new tasks (Antal Afskibninger) before i run into the 65 component limitation,
and now I have a new requirement that the list of new tasks comes from an external webcall where each object in an array should be created as new linked issue (before it was just a number i a field i could unroll).
Without a loop construct in Jira Automation i cant see how i can iterate over the json array and thus I have been looking a ScriptRunner to see if that fixes my issues.
ScriptRunner in cloud seems to be sort of limited, as it can not plug in to the automation and thus I have to use a Script Listener.
First question: It is correctly understood, and not just en error by me, that ScriptRunner Cloud can not work directly in Jiras Automation framework?
Second question: For ScriptRunnner i have the feeling that i have all the components in a ScriptListener needed to solve this problem. Im struggling with putting them together for a solution.
I need the issue to be in a specific status:
issue.status="Klar til Ordrebehandling"
But i also need the links not to contain links that are "Afskibninger". Does anyone have idea how to do this?
For rest of script:
First i need to call an external web service and loop, i got that covered as:
baseUrl = "myUrl"
def response = get('BC13EXT/ODataV4/SalesOrders')
.queryString([ company: 'My company', '$filter': "Document_No eq 'SO123'"]) .header("accept", "application/json")
.header("Authorization", "auth string")
.asObject(Map)
.body
.value
response.each { item -> /*do stuff here*/ }
which works in the script console. For the do stuff part:
Is the better way to encapsulate this in a jira automation triggered by an incoming webhook, where i give the parent issue key and and field data to this webhook.
Or
Is the better way to call first
POST rest/api/2/issue/
and then
POST rest/api/2/issueLink
for each that i need to have created and linked.
Is there any actual difference on any of these approaches.
Thanks in advance for any clarifications :)
Best
Jens
Hi @JensH
I noted in your question this:
...the list of new tasks comes from an external webcall where each object in an array should be created as new linked issue (before it was just a number i a field i could unroll).
Without a loop construct in Jira Automation i cant see how i can iterate over the json array...
With the Advanced Branch in automation rules, you can probably do what you ask, for up to 100 items. For your scenario you would use the web response as a list to drive the branch, using the resulting data to create the issues.
You do not state to which issues you are linking, the source of the cloned issue, or the specific information used in the issue create, so those could be limitations if your rule has a lot more structure / decision making than you are showing.
Kind regards,
Bill
Thanks for the reply Bill
I'm not aware of the Advanced Branch in automation rule, could something else. I will look that up.
There is not a lot other decision making. Much of that is placed in other automations that trigger later. Structurally the Issues are the equal, but shown differently in the two projects via the a screen setup.
Thanks for the input
Best
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy I got the Advanced Branch idea to almost work. I have one issue that I cant figure out how to fix.
The newly cloned issues should have the names like 1/N 2/N ...n/N .. N/N
I got the N part working by using {{webResponse.body.value.size}}
But inside the smart branch i need to know current iteration number, i have been trying to use {{index}} as: {{#webResponse.body.value}}{{index}}{{/}}
But that gives me all indices in each iteration so i end up with:
012/3
012/3
012/3
as output.
Naturally I would like the index to start with 1, but that's currently a minor issue compared to that I cant't get the index at all.
I can see in the forum that I'm not only one with this problem, but I can't seem to find a solution for this part.
Thanks in advance
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without seeing the details of your advanced branch, I am guessing a bit here...
Having a sequential counter has be asked before, and the work-arounds depend on context / the structure of your branching. Specifically, what information from the {{webResponse}} do you need inside of the branch to create the issues?
I have used a technique in the past with created variables to create the counters. Please note that with branches (on more than one thing) in rules, the processing order is unknown because the items get processed in parallel and asynchronously. So for this scenario the issues would be created with the names 1/N, 2/N...N/N but not created in that order in Jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy Thanks for replying.
I should have added the automation, sorry, here it is, including log and generated clones.
Thanks for help.
Best
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does your {{SalesLinie}} information in the branch source contain your counter values that you want in the cloned issue summary?
Can you please show what you are using to set the summary in the clone issue action?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.