Jira Core and CalDav Synch

Josep Vila June 14, 2018

Hello all,

We have Jira Core and We would like to synch jira tasks due dates with CALDAV server.

Is that possible?

 

Thank you

2 answers

0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 30, 2018

Hi! 

it is possible. 

1. You can write a service which will sync due dates, e.g. you can use the python scripts

https://github.com/AstroMatt/atlassian-python-api

2. Otherwise you can write script in Jira using groovy, e.g. Scriptrunner, groovioly, amigo ...

3. Also, you can write own plugin for Jira.

4. Or you can write something on Caldav side.

 

Cheers,

Gonchik Tsymzhitov

Josep Vila July 30, 2018

Hi!

Indeed I've made Python script to synch due dates (it's still not finished because if I delete some key in Jira doesn't delete it on Calendar).

I copy it below, feel free to improve it and share it back.

 

import caldav
from caldav.elements import dav, cdav
from icalendar import Calendar, Event
from datetime import datetime
from icalendar import LocalTimezone
from jira import JIRA
import re
import pytz


url = "https://user:pass@domain.com/remote.php/dav/calendars/jira/"

client = caldav.DAVClient(url)
principal = client.principal()
calendars = principal.calendars()
if len(calendars) > 0:
    calendar = calendars[1]

    
    options = {
        'server': 'http://xxx.xxx.xxx.xxxx:8080'}
    jira = JIRA(options,basic_auth=('user', 'pass'))

    for i in jira.search_issues('filter=10502',maxResults=1000):
        
        cal = Calendar()
        cal.add('prodid', '-//JiraCalDavSynch//')
        cal.add('version', '2.0')
        
        
        start_date_ok = True
        end_date_ok = True
        
        
        if str(i.fields.customfield_10301) != 'None':
            event_start = datetime.strptime(str(i.fields.customfield_10301), "%Y-%m-%d")
        else:
            start_date_ok = False
            
        
        if str(i.fields.duedate) != 'None':
            event_end = datetime.strptime(str(i.fields.duedate), "%Y-%m-%d")
        else:
            end_date_ok = False
        
        
        event_created = datetime.strptime(str(i.fields.created)[0:10], '%Y-%m-%d')
        
        
        if((not start_date_ok) and end_date_ok):
            event_start = event_end
        elif(start_date_ok and (not end_date_ok)):
            event_end = event_start
        
        
        if(start_date_ok or end_date_ok):
            event = Event()
            event.add('summary',i.key+': '+i.fields.summary)
            event.add('dtstart', event_start )
            event.add('dtend', event_end)
            event.add('dtstamp', event_created)
            event.add('uid',i.key)

            cal.add_component(event)

            event = calendar.add_event(cal.to_ical())
0 votes
Josep Vila June 15, 2018

any suggestions?

 

Thank you

Suggest an answer

Log in or Sign up to answer