Dear Community
I have an Epic which has 2 stories. The story has a scripted numeric custom field named 'Delivery Estimate'. I want to get the sum of this field from stories to Epic. For this I have created a scripted field "Total Delivery Estimate", and I have written below code to fetch the values of Delivery Estimate at Epic level. The issue I see here is, jira script getcustomfieldvalue, does not fetch the value if custom field is 'scripted field'. Can anyone suggest if this is feasible and what would be the correct code.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager
def value=0;
def linkType = issueLinkTypeManager.getIssueLinkTypes(false).find{ it.name == 'Epic-Story Link' }
def issueLinkList = issueLinkManager.getOutwardLinks(issue.id).findAll{ it.getLinkTypeId() == linkType.getId() }
for (issueLink in issueLinkList) {
def childIssue = issueLink.getDestinationObject()
def customField = customFieldManager.getCustomFieldObject('customfield_22601')
int currentValue= childIssue.getCustomFieldValue(customField)
if(currentValue){
value = value + currentValue
}
}
return value ;
Hi @Parvez Misarwala
I had a similar problem.
My workaround was to save that scripted field into another custom field .
That way I can fetch from the "normal" custom field instead of the scripted field.
Code inside your story scripted field:
.....
.....
calculate the value to return , lets call it X
save X inside your "normal" custom field
return X
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.