Forums

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

Update Summary based on Automation Rule duplicates the Summary

MikeSierra NOC
Contributor
April 23, 2023

Hello Community,

I'm trying to achieve the following ->  Link to similar issue 

My automation rule looks like:

2023-04-24 01_54_50-Window.png2023-04-24 01_55_09-Window.png

Everything works like a charm, but the issue comes when one of our users modifies one of the fields Carrier 1 or Carrier 1 TicketID for the second/third/etc. time, the Summary will get duplicated...

This is how it looks if one of our users append for the second or third time the value issue.Carrier 1 Ticket ID:

2023-04-24 01_58_44-Window.png

I see that I can use the substringBefore(), but I really do not understand how should I use it.

My issue it's really the same as the linked one on the top of this question.

If somebody would be kind enough to explain a little like for newbies, I would really appreciate.

Thanks,

MikeSierra

 

1 answer

1 accepted

1 vote
Answer accepted
Joseph Chung Yin
Community Champion
April 23, 2023

@MikeSierra NOC -

It is exactly as your linked issue solution, it simply means that the Summary content will always strip out the original Carrier 1 and Carrier 1 Ticket ID, and then replace it with the new Carrier 1 and Carrier 1 Ticket ID information.

In other words, it will always create the new Summary content using the original Summary value + the latest Carrier 1 and Carrier 1 Ticket ID information.

Take a look at the smart value help guide link - https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#Smartvaluestextfields-substringBefore(Stringseparator)

Hope this helps.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

MikeSierra NOC
Contributor
April 24, 2023

Hi @Joseph Chung Yin

I tried but I didn't know how to use it.

 

I saw the documentation, but I don't know how to adjust the automation rule in order for it to work..

MikeSierra NOC
Contributor
April 24, 2023

So, right now, this is how the Then: Edit issue fields look like:

2023-04-25 00_26_25-Window.png

How this should be adjusted with the before mentioned String so it works?

Thanks

Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

It will be something against the Summary field and only get the original summary value -

Example - My original summary value is "Hello", then I appended " *World" to it.  

So for me to get the original summary value before appending the new Carrier 1 and Carrier 1 TicketID value, I will use 

{{issue.summary.substringBefore("*")}}

In your case will be -

{{issue.summary.substringBefore("*")}} | {{issue.Carrier 1}} | {{issue.Carrier 1 Ticket ID}}

Hope this makes sense.

Best, Joseph

MikeSierra NOC
Contributor
April 24, 2023

Hi @Joseph Chung Yin

I've appended the new one that you just told me, and it still gets duplicated:

2023-04-25 00_59_46-Window.png

I've changed 2 times the Carrier 1 Ticket ID, and it got duplicated on the both attempts.

This is how the Edit issue Summar looks like now:

{{issue.summary.substringBefore("*")}} | {{issue.Carrier 1}} | {{issue.Carrier 1 Ticket ID}}

Thanks,

Mike

Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

Since when you append the fields value, you are using the "|" character, please try substringBefore("|").

My example was stating that I use the "*" appending the original summary value.

Best, Joseph

Like MikeSierra NOC likes this
MikeSierra NOC
Contributor
April 24, 2023

@Joseph Chung Yin -

Now it strips all the Summary and leaves only the Carrier 1 & Carrier 1 Ticket ID.

2023-04-25 01_08_13-Window.png

Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

Hi Mike:

Just make sure I understand the whole picture, please validate if the following is correct -

Initial issue after creation - Summary is "Hello World"

After 1st editing of the custom fields - new Summary value is Hello World | TELNYX | POxxxxxx

After the next editing of the custom fields, new Summary value is not showing as Hello World?

The syntax of 

substringBefore(String separator)

Returns the text before the first occurrence of the given separator.

1 {{issue.summary.substringBefore("W")}} -> Hello
Should have given you "Hello World" as the original summary value and then append your new fields values.  

Best, Joseph

Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

I just created a quick test.  Here is the syntax I used in the Edit Summary field action with the trigger event when "Country-City" field value is changed (Only applicable in the Edit Issue operation)

2023-04-24_15-55-29.png

In this case, I don't want this rule to fire when the Country-City field is populated during the Create issue operation.

{{issue.summary.substringBefore("|")}} | {{issue.Country-City.value}} | {{issue.Country-City.child.value}}

In my test case, I have a custom field "Country-City" (cascade dropdown field).  Once it is updated during an actual edit issue event, it will grab the value from field and append to the original Summary field value.

So Issue Created initially - Summary is "Hello World"

1st Update of the Country-City field - Summary is now Hello World | USA | San Diego 

2nd Update of the Country-City field - Summary is now Hello World | Japan | Osaka

Another thing is a great tool for you to debug your automation rule (especially with smart value test is to write the output to audit log for verification).  Here is the reference link on debugging process - https://support.atlassian.com/cloud-automation/docs/debug-an-automation-rule/

Best, Joseph

Like MikeSierra NOC likes this
Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

If my suggestions helped you, please remember to click on Accept answer when you have a chance, so others with similar questions can find this post as an answered ask with solutions.

Best, Joseph

Like MikeSierra NOC likes this
MikeSierra NOC
Contributor
April 24, 2023

@Joseph Chung Yin I have setup exactly the same flow as you described, now it works, but it still strips the Summary when Carrier 1 Ticket ID gets changed during edit, not on the initial create of the ticket.

I don't know what I'm missing here, or what I'm doing wrong, but....

2023-04-25 02_23_04-Window.png

Here's the ticket history:

2023-04-25 02_24_03-[NOC-7593] P2 _ TELNYX _ PO_929ef6 - Jira.png

So as you can see, the title will go from: P2 | NOC | SUMMARY | TELNYX | PO_929ef5 to P2 | TELNYX | PO_929ef6.

Joseph Chung Yin
Community Champion
April 24, 2023

@MikeSierra NOC -

Based on the audit log activities - Your original Summary value is P2 | NOC | SUMMARY | TELNYX | PO_929ef5, then it got updated to P2 | TELNYX | PO_929ef6, the rule is working.

The substringBefore syntax correctly just retain "P2" and then append the new fields values.

So I don't understand your meaning of SUMMARY is still being stripped off?   What is the original summary field value of your issue?

Best, Joseph

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events