How to access "sourceIssue" during validator for cloned issue using java api?

Tagged with ScriptRunner as I know that plugin has made this available as 'sourceIssue' - wondering how to get that information when using the underlying api.

I've tried accessing fields via issue, and both the issue and originalissueobject in transientVars - but no luck for either - either the object reference is null or the particular field returns no value - or I get the exception about issue having not been saved yet.

Hoping Jamie Echlin can provide details on where that field in ScriptRunner is retrieving this object from or any other suggestions.

3 answers

If i understand the question you are asking how to access the issue in a custom jira workflow extension.

If that's the case:

when you implement the interface WorkflowPluginValidatorFactory you need to provide a concrete implementation of the validate method, this method needs an parameter of type Map called transientVars, from this map you get the issue being validated.

I'm specifically looking for how to get at the original/source issue during a validation when an issue _clone_ is taking place.

I actually don't really care about the original issue so much as being able to access the 'reporter' information from it. Accessing reporter with issue.getString("reporter") works fine in the case of creating a new issue or an update to an existing issue - but when doing it on a cloned issue I get an exception that the issue hasn't been saved yet.