I have a script in ScriptRunner that I've tried as both a post function and as a listener (on the create issue event). When I create the issue manually (by clicking on the Create button) everything works fine (both as a post function and as a listener). However, when I perform a CSV import to create issues, the script errors/can't find the link to one another users story. This link is created during the import.
The funny part is that when I'm cycling through the links, it finds the Epic Link no problem, which is created at the same time.
So what is different about the create process on an a CSV upload compared to a manual creation when it comes to link creation? Or the difference between how the epic link is created vs a regular link?
Is there something I should be doing in my script before trying to search for the link?
Below is what I'm using the iterate through the links. I did check the outward links as well, putting debug statements in and running it when creating manually, shows the user story is an inward link.
List<IssueLink allInIssueLink = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getID())
for (Iterator<IssueLinks> inIterator = allInIssueLink.iterator(); inIterator.hasNext();_
{
IssueLink issueLink = (IssueLink) inIterator.next()
def linkedIssue = issueLink.getSourceObject()
if (linkedIssue.issueTypeObject.name == "User Story")
{
userStory = linkedIssue
}
}
When I add the update issue event to the listener and update the issue created during the import, the script executes and finds the link no problem.
Thanks in advance for any help.
I believe, when you import links as well as issues from CSV it makes it in two steps: first importing (creating) issues, then importing(creating) links.
So, if listeners listens only to "Issue Created" event, there's no link to find after step one. Maybe, try adding IssueLinkCreatedEvent to list of events listeners listens to.
That worked! Now I just have to figure out to limit to the import.
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.