Forums

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

Calendar will not show up in Team Calendar list

Anne Marie Sharp
September 30, 2022

I have created calendars in my space to embed in pages but they will not show up in the team calendar list when I try and embed them using the /calendar macro.  I have had this happen before, and it can take some time, but it has been 2 days now and I still am not getting them as options in my add list. I can see the other calendars I have but not the new ones.

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
David Fischer
Community Champion
April 28, 2022

Hi @Ajaygoud Gaddam ,

you can use a Set Issue Fields post-function, select the date field as the field to set, and use a Nunjucks script like this:

{% if issue.fields.customfield_12345.value == "XXX" %}
{{now | date('add',10,"days") | date}}
{% elif issue.fields.customfield_12345.value == "YYY" %}
{{now | date('add',5,"days") | date}}
{% else %}
{{now | date('add',1,"days") | date}}
{% endif %}
Ajaygoud Gaddam
April 28, 2022

Hi @David Fischer ,

Thanks for the prompt response.

Here is some more info for your understanding. 

* The date field is mandatory in the Create screen, so hope it should be resols with validation

* The date field should not be filled automatically to the 10, 5 days it should be greater than 10, 5 day of current date and it should be filled within creating the ticket.

It should show an error if they select within the range.

Hope this will help with the next suggestion.

Thanks,

Ajay

David Fischer
Community Champion
April 28, 2022

Oh, so if I understand correctly, you're trying to validate the field, not set it, correct?

In that case, you need to create a Build-your-own Validator with a Jira Expression like this:

!issue.customfield_12345 || !["XXX","YYY"].includes(issue.customfield_12345.value) ||
issue.customfield_12345.value == "XXX" && issue.customfield_67890 > new CalendarDate().plusDays(5) ||
issue.customfield_12345.value == "YYY" && issue.customfield_67890 > new CalendarDate().plusDays(10)

where  customfield_12345 is the single-select field and customfield_67890 is the Date (only) custom field.

Ajaygoud Gaddam
May 2, 2022

Hi @David Fischer Thanks again,

As I am completely new to scripting I didnt see were i am missing something. In the JMWE validator i have tested the expression and it shown the true valu as it fine but while creating the ticket even if we select date not in range too the ticket is not being submitted and showing the custom error what we added in the validator error.

attaching the script and logs down


!issue.customfield_10059 || !["Beijing","Berlin","Hamburg"].includes(issue.customfield_10059.value) ||
issue.customfield_10059.value == "Beijing" && issue.customfield_10060 > new CalendarDate().plusDays(5) ||
issue.customfield_10059.value == "Berlin" && issue.customfield_10060 > new CalendarDate().plusDays(10)

create.pngerror.pngscrpt.png

As I tried date field above and my requirement should be for date and time field will you please suggest next expression for date and time field.

Thanks,

Ajay

David Fischer
Community Champion
May 2, 2022

Hi @Ajaygoud Gaddam ,

since it's a Date custom field, Jira Expressions don't return a CalendarDate object but a string (for no good reason).

Try this:

!issue.customfield_10059 || !["Beijing","Berlin","Hamburg"].includes(issue.customfield_10059.value) ||
issue.customfield_10059.value == "Beijing" && new CalendarDate(issue.customfield_10060) > new CalendarDate().plusDays(5) ||
issue.customfield_10059.value == "Berlin" && new CalendarDate(issue.customfield_10060) > new CalendarDate().plusDays(10)
Ajaygoud Gaddam
May 3, 2022

Many Thanks @David Fischer ,

It works for Date custom field could you please suggest what should be added to the above expression for Date and time field.

It would be really appreciated if I would get expression for Date and time custom field.

Thanks again in advance.

Ajay

David Fischer
Community Champion
May 3, 2022

Hi @Ajaygoud Gaddam ,

I'm glad it works. For a date/time custom field, just replace CalendarDate with Date everywhere.

Ajaygoud Gaddam
May 3, 2022

Super It works, Thanks for the help @David Fischer 

TAGS
AUG Leaders

Atlassian Community Events