Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How does ScriptRunner clone issue operate

Shawn Jamison January 10, 2024

Does anyone know if the ScriptRunner clone issue creates the destination issue first then copies over the field values?  Is it a two step process?

 

My destination project has an automation that changes the Assignee when a new issue is created.

The destination issue assignee is not being updated.  It is retaining the Assignee from the source issue/project

 

Thanks

-Shawn J>

 

 

3 answers

1 vote
Nic Brough -Adaptavist-
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.
January 11, 2024

No, the clone is a single step, like it is in Jira's create and clone processes.

In the details of the clones, the code creates a "mutableissue" from the original issue which includes all the field content, and then sends that through the "create" process.

I think you need to look at your automation to see if it is actually being triggered when issues are cloned.

1 vote
Radek Dostál
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.
January 11, 2024

Rather, check that your automation was even run against that issue at all. When an issue is created, then it is the workflow which should publish the event (https://confluence.atlassian.com/display/ADMINJIRASERVER/Adding+a+custom+event), and then that automation can listen to events, and do it's thing. So the first step is just seeing if that automation ran against that issue at all. Second would be to verify that the workflow create step does in fact publish the Issue Created event.

 

If you were concerned about the issue being "overwritten" due to a 2-step process, you would see this in issue history. One action would update the assignee, another would change it after that. So this should also be an indicator.

 

All in all I doubt SR is a 2-step process, it probably just builds the field:value map and creates the issue with all of it's field data. It may use extra steps for issue links, but it most probably doesn't for the issue itself. I suspect your automation is simply not picking up on the new issue. If not, it's a missing event. When it's a missing event, the workflow should be responsible to publish one.

1 vote
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
January 10, 2024

Hi @Shawn Jamison

Quick question, since you are using ScriptRunner to clone the issue, why not use it to set the Assignee as well when using, for example, a Post-Function?

Why use Automation only to set the Assignee?

If you need an example on how to do this, I can provide one.

I am looking forward to your feedback and clarification.

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer