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,998
Community Members
 
Community Events
176
Community Groups

Issue summary with conditional logic & smart values

I want an issue summary to contain custom field information but with a little logic. 

Stick with me here...

The issue will have one of two potential date fields filled in depending on other options in the issue. So for ease we will call them issue.CustomDate1 and issue.CustomDate2

I want the issue Summary to have some text and then insert CustomDate1 -OR- CustomDate2, whichever field has a value as the other will be null. 

How would that be scripted?

2 answers

1 accepted

3 votes
Answer accepted
Jack Brickey Community Leader Feb 22, 2022

if one is always empty try just including both...

Action - edit issue - Summary

{{issue.summary}} - {{issue.due date}} - {{issue.other date}}

this will append both dates but if say the first is "none" then you get this...

this is my summary - - 2202-02-23

as an example

On a low level, this could work. We would just a random space that nobody will realize except me. 

As someone who likes easy solutions, this appeases me 😎

As someone who is OCD and is unnecessarily focused on formatting, this annoys me 😑

Hi @David Quiram 

Yes, and...to what Jack suggests:

  1. If one is *always* null, just put them side-by-side and one will disappear, without the extra delimiter: {{issue.summary}} - {{issue.firstDate}}{{issue.secondDate}}
  2. Otherwise, you could use the conditional logic to do this in-line or use if/else components for extra testing: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

I recommend #2 as *always* may be difficult to enforce/remember.

Kind regards,
Bill

Like # people like this
Jack Brickey Community Leader Feb 22, 2022

You can add an if/else condition to check one of your date fields for empty and if empty then use the other date, if not the use that date.

now what I find worrisome is the fact that you could have a date in both so I think you need to consider this in your automation to help flag this apparent error condition.

Jack Brickey Community Leader Feb 22, 2022

Yes as @Bill Sheboy says You can omit the delimiter. I left it in thinking it might be nice to be able to identify which date was applied based on placement in summary.

Like # people like this

@Bill Sheboy So I agree and would love to use conditional logic for this task. I had reviewed that article you linked numerous times before posting here and I don't understand how I would script it out. 

I know it's possible, just don't know what syntax to use. There's no clear example on that article referencing my exact situation from what I can tell. 

On that page, please take a look at the example for the exists() function to do what you ask: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/#exists

That function checks if a field has a value, and then uses it when present.

Like David Quiram likes this

Ahh! Thank you for pointing me to that specific function. I think I have an idea of how to script this now... time for testing. 

Like Bill Sheboy likes this
0 votes
Curt Holley Community Leader Feb 22, 2022

Hi @David Quiram 

At a high level it would go like this:

dd.png

by using the {{issue.Summary}} smart value, the automation repopulates the existing summary. Then by added {{issue.duedate}} (or in your case, one of your custom date fields) you get the date after the Summary.

You could simply do a rule for each field or use an If/else condition.

You can also format the date to best suit your needs. See Jira smart values - date and time | Cloud automation Cloud | Atlassian Support

So this Summary is being filled in on a linked issue during a Create Issue action in an automation flow. Hence why I was looking for conditional logic in smart values. 

Curt Holley Community Leader Feb 22, 2022

That can be done @David Quiram via branching and some smart values. Best you state your complete use case so we can provide more focused responses for you.

OK, hopefully this helps clarify everything for you. 

Automation will check an issue on creation and create a linked issue in another project if it meets specifics requirements. That is all working just fine. 

On the created linked issue, I would like the Summary to include some text and either CustomDate1 or CustomeDate2, whichever field has a value as the other field will be null. 

Curt Holley Community Leader Feb 22, 2022

In that case @David Quiram it will be very much as @Jack Brickey has suggested, but as part of the creation of the linked issue:

Action - Create issue

Summary: {{triggerIssue.summary}} - {{triggerIssue.SomeOtherText}} - {{triggerIssue.due date}} - {{triggerIssue.other date}}

Resulting in something like:

this is my summary - this is the other text - - 2202-02-23

Obviously you need to define where from the trigger issue you are getting the extra text from. And as discussed here, you can format the summary field to your requirements and add if/else or any other conditional logic required. 

But by using the triggerIssue smart values in the creation of the linked issue, as generated by your currently working rule using the "Issue Created" trigger, should see the results you are after in the summary field of the linked issue.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events