Hi Everyone,
We have the Addon JIRA MISC CUSTOM FIELD
https://innovalog.atlassian.net/wiki/spaces/JMCF/overview?homepageId=141891457
I would like to create a calculated field in an epic that would sum the values of a number custom field filtered on the current linked issues of the epic.
I am pretty sure this is possible to do it with the addon but i am struggling to write the right script, as I have too few knowledge on Groovy script. Could anyone help me with a code ?
Here is what i would like :
Epic
Calculated custom field = Sum of values of linked issues Custom field 1
Epic Linked issues
Issue 1
Value Custom field 1
Issue 2
Value Custom field 1
Issue 3
Value Custom field 1
Thank you so much for your help!
Hi Like,
I have a basic question about the examples shown here.
Is there somewhere a general description of all possible programming commands for automations, preferably with examples?
Thanks
Arne
Hi @Arne Becher ,
you mean beyond the JMCF documentation? The documentation already provides information about the Groovy language, with a tutorial and a lot of examples.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Like,
thank you very much.
However, I meant commands for Jira Automations to be used in general.
Also I oversaw that the thread above is related to jira server and an add-on for that. Unfortunately I use jira cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
what is the link between the Epic and the issues from which to sum the custom field? Are they the issues that belong to the Epic? If so, you can use this:
issue.stories.sum {it.get("customfield_12345")?:0}
If they are issues linked to the Epic through issue links, you can do something like:
issue.getLinkedIssues("link type direction").sum {it.get("customfield_12345")?:0}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David, Thanks for your answer!
I tried and the script returns no error but even though my fields have values it still returns "null"
I created 3 tasks and completed values in the custom number field i want to sum + have added the epic link but it doesn't seem to sum the value in the calculated field in the epic...
Could it be because of the "link type direction"?
Thanks again for your precious help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you have added the Epic Link on the tasks, that means the task belong to the Epic. You therefore need to use the first script I provided.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Please provide script to add sum of one or more custom fields from Stories to EPic.
Here is what i would like :
Epic
Calculated custom field = Sum of values of linked issues Custom field 1 and Custom field 2
Epic Linked issues
Issue 1
Value Custom field 1
Value Custom field 2
Issue 2
Value Custom field 1
Value Custom field 2
Thanks,
Gunti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Gunti_Reddy ,
try this:
issue.stories.sum {
it.get("custom field 1")?:0 + it.get("custom field 2")?:0
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David, Thanks for your response,
getting below error, but it works when i add one custom field for sum.
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#plus. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.String] [class java.lang.Number]
Below line works for one custom field sum.
issue.stories.sum {it.get("customfield_15462")?:0}
Thanks,
Gunti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I made small changes and working for two custom fields sum as well.
issue.stories.sum {it.get("customfield_15460")?:0} + issue.stories.sum {it.get("customfield_15462")?:0}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, sorry, I had forgotten to add parentheses:
issue.stories.sum {
(it.get("custom field 1")?:0) + (it.get("custom field 2")?:0)
}
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.