custom field display the numbers

Carla Ann Rowland
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.
August 25, 2021

Hi, 

I have sub-tasks in my jira instance to allow my customer to log more than one payment and avoid making multiple fields.

I am still learning scriptrunner and using the tutorial on the site create my first scripted field. 

It works great until I get to the two customfields in my sub-task payment issue type:  custom field payment because it is a numeric field and a single select list of payment sources. The output is this on my parent issue:

output of scripted field.png

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2021

I am not sure what you are trying to achieve here, but the table with empty cells suggests your script is not presenting any data to go into the cells, probably because it is failing to read it (that's the usual culprit behind an empty result).

I can't really help without a better understanding of what you are trying to do (a statement like "add up some numbers on all the subtasks of an issue and show it on the parent issue" would be great ), or seeing what your script says at the moment.

Carla Ann Rowland
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.
August 27, 2021

Apologies for incomplete info and thank you for your help.

I created a sub-task that holds the payment in two custom fields: Payment Type and Payment Amount. The header in the table are the same of the fields. I don't know how to build the code to pull the data from those custom fields on the sub-task into the table on the "parent linked issue".   So yes I want to pull the number fields that live only in that subtask into the table. (Let me know if I am unclear)

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 27, 2021

Thanks, I think that has cleared up all the bits I was not sure of!

So, this library entry is a little bit mis-named - it says "from JQL" but doesn't use any JQL for Server or DC, as it doesn't need to on them.  https://library.adaptavist.com/entity/calculate-the-sum-of-fields-from-multiple-issues-from-a-jql-query

It is however, a script for a scripted field that reads a number from each sub-task, adds them together and puts the result out as the scripted field output.

It is not quite what you want, but it does show you how to grab numeric data from a set of subtasks

Like Carla Ann Rowland likes this
Carla Ann Rowland
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.
August 27, 2021

I review the snippet--- I am still learning so add to this thread if I need more assistance. Thank you. 

0 votes
Carla Ann Rowland
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.
August 25, 2021

@Nic Brough -Adaptavist- 

Hi Nic, I need your experience and wisdom.

TAGS
AUG Leaders

Atlassian Community Events