Hi all,
First of all, I'm not experienced nor skilled in coding in general, and certainly not in Groovy. I'm hoping to get some help in what I assume is a fairly simple script & question.
What I'm trying to do: create a scripted field that copies a value from another scripted field from a linked issue.
The script runs without any errors but always returns 0.0 as value. If I try copy the value of another (numeric) custom field from the linked issue, it works as expected.
Here's the code snippet (note: multiple linked issues may exist, so it starts with an iterator)
List<IssueLink> allInIssueLink = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId());
for (Iterator<IssueLink> outIterator = allInIssueLink.iterator(); outIterator.hasNext();) {
IssueLink issueLink = (IssueLink) outIterator.next();
def linkedIssue = issueLink.getSourceObject()
String type = linkedIssue.getIssueType().getName();
if (type == "Delivery") {
CustomField fInvamt2 = customFieldManager.getCustomFieldObjectByName("Already Invoiced")
def iInvAmt = fInvamt2.getValue(linkedIssue) as Double
iAmount = iAmount + iInvAmt
}
return iAmount
kind regards & thanks for any help here!
Peter