Confluence has been updated to ver 6.15.9. In case of any troubles, please contact infra team.

Sync value in custom field with component/s field

 
2
1
0
Hi! How do I sync the value chosen in Project 1 (in a custom field, single select list) with Component/s field in receiving Project 2? This is a local sync. /Robin
  1. Francis Martens (iDalko)

    Do you have a mapping between the options in the custom field and the components?

  2. Robin Essman

    issue.components = replica.customFields.“MSL
    Component/s”?.value?.value.collect{
       nodeHelper.createComponent(
          issue,
          it.name,
          it.description,
          it.leadKey,
          it.assigneeType.name()
          )
       }


    Is this the correct way to set a component from a single select custom field? 
    And I need to understand if it duplicates/creates new components or if it sets the component that actually exists in the receiving project. 

CommentAdd your comment...

2 answers

  1.  
    2
    1
    0

    Hi Marika,


    I have tested this approach out so I can finally give you a concrete answer.


    Keep in mind that this will only work if your options for the Single Select Custom Field match with the names of the components on the destination side:


    Make sure to change "Select List Test" to the actual name of your custom Field on both sides (smile)


    Outgoing (source side):

    replica.customFields."Select List Test" = issue.customFields."Select List Test"



    Incoming (destination side):

    def selectListOption = replica.customFields."Select List Test"?.value.value
    def component = nodeHelper.getComponent(selectListOption, nodeHelper.getProject(issue.projectKey))
    issue.components += component


    Thanks,


    André

    1. Marika Trygg

      Works like a charm!

      Thank you for your help!

      /Marika

    CommentAdd your comment...
  2.  
    1
    0
    -1

     Hi Francis Martens (iDalko) ,

    can I provide you with any more info, to get some advice on this one?
    Best Regards,

    Marika

      CommentAdd your comment...