Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,993
Community Members
 
Community Events
176
Community Groups

How to automate copying a part of the custom field value before the summary field value?

Hello Atlassian Community,

I've got a new request from a user that brings me to my know-how limit regarding automation rules.

The context is the following: The team lead would like to tag individual Jira Issues related to an object area with standardized labels. For example "PLM: Master data management/ maintenance" So that the team can filter via an object label. To do this, I create a custom field called "object label" of the type single choice list. 

However, the team leader would also like to have the shortkeys of these object labels (which come before  the ":") added to the top of the summary. This way he can use the text search to find all issues related to that object label. He would like that this addition to work automatically so that users only need to fill in the custom field and the custom summary as the issue title. 

The custom field is not a problem. Filtering on it isn't either. I thought I could have that auto-filled with an automation rule. 

I found on other community posts that this code might help me:

{
"fields": {
"customfield_<id>": { "id": "{{customfield_10056.accountId}}" }
}
}

 I found out that the customfield id from object label is 10056. But the system field summary does not have a customfield id. So I looked it up on the internet to probably used "https://<atlassian organization url>/rest/api/3/Summary". 

But then I got the error message: "Additional fields contains invalid field(s) in 'update' or 'fields' section: https://<url>.atlassian.net/rest/api/3/Summary".

 

Does anyone know how I can address the Summary field (copy to field)?

 

My next question is how can I copy only the value from the object label that precedes the  ":" and not the full name?

And how I can I prevent the full summary from being overwritten? I would like to add only the short key like "PLM" before the summary.

 

Does anyone already have experience with such a request? Is it even possible with Automation rule?

I am grateful for any further help and look forward to your messages.

 

With kind regards,

Anna

2 answers

2 accepted

Here is the summary of the solution from @Igor Dugalic 

 

Create an Automation Rule and use smart values.

 

So the Process goes:

1. Create issue

2. Edit issue Fields - Dummy Field: {{issue.Objekt Label}} 

3. Re-fetch issue data

4.Edit issue fields - Summary: {{issue.Dummy Field.substringBefore(":")}} {{issue.summary}} 

 

The dummy field must be of text field type.

0 votes
Answer accepted

You can use smart values for this:

{{issue.summary.substringBefore(":")}} should give you "PLM" in your example, but make sure to not have another ":" in your summary.

 

Edit: Just tried it with a simple automation and it works.

SimpleAutomationCopyValue.jpg

Hello @Igor Dugalic ,

thank you very much for your quick reply.

It is a good idea to use smartvalues. I didn't think about this option. So thank you very much.

 

I tried to use it for my context, but I didn't figure it out.

The problem is to get the shortkey from the value of the custom field "object label" and not from the summary. My plan is to add it to the summary.

 

So I used this smart value: {{issue.summary.concat(customfield_10056.substringBefore(":"))}}

 

The audit log tells me that the summary edit was successful, but I can't see any changes in the summary.

So I added the value of {{issue.customfield_10056.substringBefore(":")}} to the audit log. This was also successful, but the entry is empty. 

So I conclude that the problem is to issue the shortkey.

 

Do you got any ideas to handle this?

Here is a screenshot from my automation rule:Automation Rule2.png

This should work to get the value you require:

{{issue.object label.substringBefore(":")}}

And to set the summary:

{{issue.summary.concat(object label.substringBefore(":"))}}

But this will result in the new Summary being the "Old Summary" + "PLM" without any space. 

If you want the PLM before the Old summary you can use this:

{{issue.object label.substringBefore(":")}} {{issue.summary}}

 

Edit: Replace the "object label" with "Objekt Label".

Hello  @Igor Dugalic ,

Thank you very much for your help. The smart values are comprehensible for me.

But I am sorry that I have to turn to you another time.

Because it still does not work. Maybe I need to change other settings?
I have already tested several spellings of the custom field. Including the last German one you wrote me.

 

updated Automation Rule.PNG

Hi Anna,

I missed the part where you said that the field is a single choice list, the method I provided will only work with text fields. A workaround would be to create another text field. Copy the value of "Objekt Label" to the new text field and then take this new text field into your automation. This can all be done in 1 automation, but you need to have the "Re-fetch issue data" between the 2 actions.

So the Process goes:

1. Create issue

2. Edit issue Fields - Dummy Field: {{issue.Objekt Label}}

3. Re-fetch issue data

4.Edit issue fields - Summary: {{issue.Dummy Field.substringBefore(":")}} {{issue.summary}} 

 

Best,

Igor

Like Anna Deutrich likes this

Hello @Igor Dugalic ,

thank you very much for this helpful information.

I created the new field and edited the automation rule as described. But unfortunately the addition to summary does not work. The Object Label is be copied to the textfield. 

I created the new field as long text and a second time as short text, but still the same.

email about automation.JPGupdated Rule Audit log.JPG

Hello @Anna Deutrich

can you also post a screenshot of the change summary rule? I tested it and it works on my test instance.

Best,

Igor

Hello @Igor Dugalic ,

thank you for coming back to me. 

Of course I can send you a screenshot of the change summary rule.

 

Best, 

AnnaChange summary.PNG

Hallo @Anna Deutrich 

I can't seem to recreate the issue you are facing, can you try changing the "colon" symbol in the rule and in your option to an underline and check if this works.

So the option should be "TZ_Transportzone" and the rule "{{issue.dummy field.substringBefore("_")}} {{issue.Summary}}"

 

Or try it again with customfield_id instead of "dummy field" and "Objekt Label". 

You can also contact me via twitter/linkedin and I can invite you to my test instance.

Best,

Igor

Hello @Igor Dugalic ,

thank you very much for your help. It works now!

Today I created everything again, but on our second Jira Tenant. There it worked immediately. 

 

I don't know where the problem is on the other tenant, but it does not matter, because in a month we will use only the second Jira Tenant. So luckily it fits there.

 

I am so grateful for your kind and great help to figuring this out. I learned a lot about using Smart Values. Thank you so much and have a nice weekend.

 

With kind regards,

Anna

Hello @Anna Deutrich 

glad it works now.

 

Wünsch dir auch noch eine schönes Wochenende.

Best regards,

Igor

Just FYI, I found the bug in the other Jira tenant where the automation rule was not working as intended. I had the dummy field hidden in the field configuration.

If I hide the field only in the Issue View Screen and show it in the Create Screen, everything works.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events