# Link a project and track time

Once the [connection is set up](https://docket.rocks/en/docs/jira-setup), a project manager links each docket project to
its Jira project.

---

## Linking the project

1. In the project, open **Settings** and find the **Jira** panel.
2. Choose the **connection** (the Jira site) and search for the **Jira project**.
3. Choose **what to mirror**:
   - **The whole Jira project**: every issue, the usual case.
   - **Only some epics**: when one Jira project holds several of your projects as epics. docket
     mirrors the chosen epics with their stories, tasks and sub-tasks, nothing else. Other docket
     projects can take the remaining epics of the same Jira project, but each epic belongs to one
     docket project. You can **change the scope** later in the same panel: added epics are
     fetched, and the tickets of a removed epic keep their time and are closed by the daily check.
4. Click **Link project**.

docket imports the issues in the background (large projects take a moment). The **Tickets area**
setting in the Jira panel decides what the tickets area looks like, and you can switch it any
time:

- **Jira replaces it** (the default): the **Tickets** tab opens the Jira project, and the
  **Boards** and **Roadmap** tabs disappear, since planning now lives in Jira. You book time on
  the Jira issues (read-only, with their Jira key).
- **Jira extends it**: docket's own tickets, boards and roadmap stay, and the Jira issues are
  listed below docket's tickets under *From Jira*. Pick this when part of the team works without
  Jira access and books time on docket tickets. A Jira ticket shows what Jira says about it and a
  link to Jira; the only thing you do with it in docket is log time. Boards and the roadmap hold
  only docket's own tickets, because the Jira ones are planned in Jira.

---

## Time-sync settings

You set these switches when linking, and any time later under **Project → Settings → Jira**:

- **Push time booked in docket to Jira** (on by default) decides whether time also lands in Jira.
  On: every booking is pushed to the matching Jira issue, as the person who booked it. Off: time
  on these tickets stays **in docket only**, and nothing is written to the Jira worklog.
- **Show time logged directly in Jira** (on by default) pulls worklogs entered in Jira into
  docket, read-only, and shows them as "Time logged in Jira" under **Project → Controlling →
  Timetrackings**: who logged how much, with revenue for mapped users. This time does **not**
  count in budgets, reports, revenue or invoices.
- **Turn it into real docket time entries for mapped users** (off by default, only visible while
  the switch above is on): for team members whose Jira account is mapped to a docket user *and*
  who have a service set, newly imported Jira worklogs become **real docket time entries**. They
  count in budgets, reports and revenue like time booked in docket, rated at the user's service
  and rounded to 15-minute steps. Time of unmapped people stays read-only. After conversion,
  docket is the source of truth, so edit or delete the entry **in docket**: a deletion in Jira
  removes the converted entry, but edits in Jira are ignored. Only time imported *after* you
  switch this on is converted.

### Changing the settings later

- **Turning push off:** future bookings stop syncing. Time already pushed **stays in Jira**; to
  remove it, use **Remove docket time from Jira** (below).
- **Turning push on:** new bookings sync from then on. **Sync existing docket time to Jira now**
  also pushes every earlier docket entry on this project that isn't in Jira yet.
- **Remove docket time from Jira** (admins only) deletes **every** worklog docket pushed to Jira
  for this project. Your docket time entries stay untouched.
  - *On core Jira*, docket can only delete a worklog as its original author. Entries of people who
    no longer have a connected Jira token can't be removed automatically and are flagged instead.
    On **Tempo**, removal works for everyone via the connection's Tempo token.

Apart from that, **Tempo** behaves like core Jira here (push, catch-up sync and removal).

---

## Everyday use

- **Find a Jira ticket** in the project's **Tickets** tab, or search its Jira key in the
  time-tracking ticket selector.
- **Book time** as on any docket ticket. Each entry on a Jira ticket shows its sync status:
  - **Synced to Jira** ✓: pushed.
  - **Syncing to Jira…**: in progress.
  - **Jira sync failed**: click **Retry** (see [troubleshooting](https://docket.rocks/en/docs/jira-sync-behaviour)).
  - **Not in Jira — connect your Jira account**: do
    [Part 2 of the setup](https://docket.rocks/en/docs/jira-setup); the entries then go to Jira by themselves.
- **Open in Jira:** click the Jira key badge on a mirrored ticket.

Assignees, statuses, due dates and priorities always come **from Jira** and update in docket on
the next sync (a few minutes). You can't edit a mirrored ticket in docket, only book time on it.

---

## Switching a project to Jira after you've already tracked time

Linking a project that already has docket tickets and booked time loses or overwrites
**nothing**:

- **Your docket tickets and all their time stay.** Linking only *adds* the Jira issues as new
  tickets. New work is then tracked on the Jira tickets.
- With **Jira replaces it**, the **Tickets** tab opens Jira, so you won't see the old docket
  tickets there. They're still in the project: their time keeps counting in **budget,
  Controlling and reports**, and you can still pick them by name or number in the
  **time-tracking view** to view or edit those entries.
- Time on the **old docket tickets is not sent to Jira**, because they have no Jira counterpart.
  **Sync existing docket time to Jira now** also covers only the Jira tickets.
- To undo, **Unlink** the project (Project → Settings → Jira → Unlink). The Tickets, Boards and
  Roadmap tabs come back, and docket asks what happens to the Jira tickets in docket:
  - **Keep** (the default): Jira tickets **with booked time** stay, with all their time. Tickets
    without any time are removed, since they only existed because of the link.
  - **Remove**: every mirrored Jira ticket is deleted from docket, **together with its time
    entries and imported Jira worklogs**. The dialog says how many entries and hours that is. Use
    it for a mis-link whose time you don't want to keep.

  Both only affect docket. Time already pushed stays in Jira. To take it out of Jira, use
  **Remove docket time from Jira** *before* you unlink.

---

## Linked the wrong Jira project, or switching to a different one

There's no "change project" button on purpose: you **unlink** and then **link the right
project**.

**No time booked yet:** just unlink. The imported tickets are empty, so they're removed
automatically and you can link the correct Jira project right away.

**Time already booked on the wrong project's tickets:** unlink and link the right project. Then:

- Tickets **with booked time stay in docket**; hours, budget and Controlling don't change. The
  daily check closes them (so they leave the Workload view), and they become frozen history.
- **New time booked on those old tickets stays in docket only.** It's never pushed to the
  previously linked Jira project.
- To move time to the *new* project's tickets, select the entries in **Timetracking → Reports**
  and use **Move** to change their project and ticket. Jira follows automatically: the worklog is
  removed from the old Jira issue and, if push is on, created on the new one.
- Worklogs docket already pushed to the **wrong Jira project** stay there. If they shouldn't,
  click **Remove docket time from Jira** *before* you unlink. After unlinking, docket can no
  longer clean up that Jira project.

**Tickets "stuck" in another project:** if the Jira project you link is already mirrored in a
different docket project *with booked time* (e.g. after moving a Jira integration from one docket
project to another), docket shows a warning, both when you pick the project and later in the
settings panel. Those tickets are never moved automatically, because their hours and revenue
would silently switch projects. Move their time entries via **Timetracking → Reports → Move**, or
leave them where they are. Tickets left without time move to the newly linked project
automatically within a day.

---

Next: **[how the sync behaves, and what to do when it looks wrong](https://docket.rocks/en/docs/jira-sync-behaviour)**.