conditional content while creation
Asked by Adrian.Seiler:

Hi guys,

I've the problem, that we have automatically created tasks (monthly automation routine).  
One field in that tasks shall show the current quarter.

I've created an automation job 'when ticket is created', with if else blocks, but it doesn't work.  
The ideal solution would be in the field directly.

Is there an possibility to get this work?

We use Jira Cloud.

Thanks for feedback,  
Best regards,

Adrian


Answers:
author: Stefan Salzl
body: Hi [@Adrian.Seiler](/t5/user/viewprofilepage/user-id/4793449) and welcome to the community,

first of all: is that a tricentis/tosca T in your avatar? ?

I would suggest to edit the monthly automation rule to immediatly create/fill that field on creation (as far as I got it right this monthly automation rule already exists). a few quiestions to further specify the requirement:

* Which field is the quarter supposed to be written?
* Is that a standard field or a custom field?
* Which format should it be shown? Q1,2,3 ?
* you wrote "current quarter": Does that really mean "current"? so always be up to date (which means the field for all those issues would change if quarter changes). Or does it mean: "quarter at time of creation"?

Best  
Stefan

comments: author: Adrian.Seiler
body: Hi Stefan,

thanks for your fast reply.

- the field 'quarter' is an custom short text field

- the format supposed to be shown is Q1, Q2 ... etc.

- the current quarter will be taken by if else statement when current date will be compared by formular {{now.format("MMM")}} and given short month format in if else condition "Jan" or "Feb" ... etc.


author: Adrian.Seiler
body: ... and btw. yes it's the old Tosca Tricentis Icon :)   
I'm impressed that you them and the software


author: Stefan Salzl
body: Is there anything giving more input in the audit log of the automation rule? Does the rule anything or just no result at all?

Did you also consider the .isBefore - .isAfter function for smart values? i guess with this it could be decreased to 3 main-branches of if-conditions.

```
{{[date1].isBefore([date2])}}

{{[date1].isAfter([date2])}}
?
```

I know the company and the product because I worked there some years ago :)


author: Stefan Salzl
body: Hi [@Adrian.Seiler](/t5/user/viewprofilepage/user-id/4793449) ,

got aware of another a format option for quarter.

```
{{now.format("Q")}}
```

This will give you the number of the quarter of the specific date.

Best  
Stefan


author: Adrian.Seiler
body: Hi Stefan,

I'm impressed. This solution worked like a charm.

It's perfekt.

Thanks.


author: Stefan Salzl
body: Honestly I was impressed myself. Found this in another discussion here in the community and immediatley thought that would exactly be what you were searching for :)

So happy it works now.

Please consider to click accept so that this question gets marked solved ??

Best  
Stefan


author: Mark Segall
body: Hi [@Adrian.Seiler](/t5/user/viewprofilepage/user-id/4793449) and welcome to the community!

Can you please share a screenshot of the rule so we can have further context to help you?

comments: author: Adrian.Seiler
body: ![jira-automation-field_quarter.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/187152i55C30936FB169B05/image-size/large?v=v2&px=999 "jira-automation-field_quarter.jpg")


author: Adrian.Seiler
body: Hi Mark,

the attached image show the if else statement when the task will be created.  
It compare the current date in format {{now.format("MMM")}} with condition of short month 'Jan' or 'Feb' etc.


author: Adrian.Seiler
body: Hi Mark,

the solution from Stefan works perfect.

Thanks for your help.

Best,

Adrian


Tags: cloud