Copy Components field to custom field

Dominik Vavra April 3, 2018

Hi guys,

Im trying to create script, that will assign issues later in workflow based on Component/s (no connection with Component Lead). Main issue is, that copying the value to custom field doesnt work as expected. When im trying to copy the value to Single Choice List field, there is no change in that field (value is None) - Single Choice List has choices exactly as they are in Component/s, tried with "test" as component too. When im trying to copy the value to Single Line Text field, the value is copied but i cant use the value in text field to assign ticket (nothing happens with the assignee) - im using script that is working on another workflows. Can someone help me find solution how to copy Component/s value to field that will be used for changing assignee or how to use Component/s directly to assign issue to user? There is only one component in Component/s field everytime.

Workflow:

1. Create Issue

2. Issue assigned to Component Lead for Approval

3. After Approval, in this step the issue should be assigned based on Component

1 answer

1 vote
Christopher Jaksch
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.
April 3, 2018

Hi @Dominik Vavra,

one way to resolve this would be via a script add-on (e.g. Powerscripts for JIRA).

Let's say you are in status "Open", component = "test" and your component lead transitions the issue to "In progress". On the transition you could add a simple script to your post function in the workflow, so it would be automatically assigned to "mrpower".

1. Create a post function via SIL script like this:

if (elementExists(components, "test")) {
assignee = "mrpower";
}
if (elementExists(components, "component xyz")) {
assignee = "jsmith";
}

 2. Add the script to your workflow's postfunction

This should work really well.

Let me know if it's working for you.

Best wishes
Chris (STAGIL)

Dominik Vavra April 3, 2018

Hi @Christopher Jaksch,

thank you, its working as expected :)

Suggest an answer

Log in or Sign up to answer