Forums

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

How to copy Organizations into Labels?

Christian Happel
Contributor
July 29, 2022

I was able to take the info from the Organizations field in customer support tickets and put it into a read-only text field. (see screenshot)
But I'd prefer to have each organization of that ticket to be added as a separate Label.

Unfortunately the Organization field doesn't seem to be available in the Automation to choose from as an input field for Labels. (see screenshot)

Is there maybe a way to achieve this with custom JSON code?

2022-07-29 12_23_47.png

2 answers

1 accepted

4 votes
Answer accepted
Jack Brickey
Community Champion
July 29, 2022

Can you try this?

{{issue.Organizations.first.name}}

it worked for me. You will will want to test if the label is simply added and does not overwrite existing labels. 

Christian Happel
Contributor
July 31, 2022

Hi @Jack Brickey ,

first of all thanks for your response! I tried it out but unfortunately don't get it to work. But this could also be because I didn't describe my problem properly:
I want to set the labels not on the original customer-support ticket, but only when someone links a Jira development ticket to this support ticket.
So somehow I need to define the automation in the Jira dev project to run whenever someone links it to a support ticket, and then pick the Organization from the destination (support) ticket and put it into the labels of the dev ticket.

If you know how to achieve this, could you make me a screenshot of that part of the edit-issue-step in the automation?

Thanks so much, Christian

Christian Happel
Contributor
July 31, 2022

@Jack Brickey 
I got it. In the end I only had to use  

{{destinationissue.Organizations.first.name}}

 in the Set Value field of the label.

Thanks so much for this hint!

Christian Happel
Contributor
July 31, 2022

@Jack Brickey Well, I ran into one more problem here: It's only taking the first Organization into the labels. But in case there are multiple organizations assigned, those aren't adding any labels.
Any idea on this one?

Jack Brickey
Community Champion
July 31, 2022

Hi @Christian Happel ,

I was trying that same thing but could not get it working. Please post the full rule here for others.

Here is what I came up with...


The process is to link the JSM to the JSW from the JSW issue. This could be reversed I think. 

I used the Create variable action to store the Organization into a smartvalue. I then referenced the variable in my action to add the label.

54EF421F-D1E7-4267-B058-7A7198DB3407.jpeg

C24B1B24-4F43-48B8-BCFF-7D5A444701DF.jpeg

 

Regarding the issue of multiple organizations I'm not sure TBH. Will need to play with it.

Jack Brickey
Community Champion
July 31, 2022

@Bill Sheboy , do you have any thoughts on the topic of capturing all Organizations here? Maybe you have a different approach altogether?

Christian Happel
Contributor
August 1, 2022

@Jack Brickey 
I'm doing it in the JSW project and pulling the data from the JSM ticket.
I didn't use any variable. See here:

2022-08-01 15_02_58.png

Bill Sheboy
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.
August 1, 2022

Hi @Christian Happel and @Jack Brickey 

There are multiple values in the Organizations field and using first will only get one of them.  

One approach, using Christian's rule shown, is to use an advanced branch on smart values and add the labels, one by one.  So your branch could be:

  • trigger: issue linked
  • condition: on the issue type
  • advanced branch: with smart value: {{issue.destinationissue.Organizations}} and variable name: varOrganization
    • action: edit issue, to add a Label using the smart value {{varOrganization.name}}

Kind regards,
Bill

Like # people like this
Christian Happel
Contributor
August 2, 2022

Thanks @Bill Sheboy and @Jack Brickey for your fast responses. I just wanted to let you know that I read them but probably won't have time to try them this week anymore and then will be on vacation for two weeks. I'll definitely get back to you if it worked.
Cheers, Christian

Like # people like this
0 votes
Aaron Geister _Trundl_
Community Champion
October 29, 2024

@Jack Brickey If your organizations have spaces in them it will show those as errors in the automation and not create the label. Is the fix to add a _ in the Organization Name Value?

Jack Brickey
Community Champion
October 30, 2024

Yes, I would think so.

Like Aaron Geister _Trundl_ likes this
Aaron Geister _Trundl_
Community Champion
October 30, 2024

That worked for me, but it seems like we should be able to append something in the smart value script to do that, but I wouldn't even know how to structure that. So, I just updated all Orgs to have _ added to spaces. 

Thanks 

Jack Brickey
Community Champion
October 31, 2024

I would think you could use JSON but would need to play with it. Going back to Bill's response on the edit action, here is where I would start 

{{varOrganization.name.replace(" ", "-")}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events