Knowledge Base Articles

Set Account on Work item creation based on a Jira custom field

This article is for Tempo for Cloud


With Jira Automation, you can set the Tempo Account based on any Jira custom field when creating a work item.

For example, you can set up a condition to check which value is selected in a custom field (such as an Organization select list), so the corresponding Account is set automatically.

Applies to Tempo Timesheets for Jira Cloud (Forge). Not applicable to Data Center.

Prerequisites

  1. The Tempo Account custom field is on the work item Create screen of the project. Since Forge, the field must be visible on the creation screen for it to be set. See Adding the Account Field to Jira Work Item Screen.

  2. Each Tempo Account is linked to the Jira project. Only linked accounts can be selected.

  3. The Jira custom field used as the source (e.g. Organization select list) is on the Create screen.

  4. The ID of each Tempo Account (Tempo API GET https://api.tempo.io/4/accounts, field id).

  5. Project admin (project rule) or Jira admin (global rule) permission.

Steps

1. Create the rule and trigger

  1. Go to Space settings > Automation (or Jira settings > System > Global automation) and select Create rule.

  2. Trigger: Work item created.

2. Add a condition on the custom field

  1. Select Add component > New condition > Work item fields condition.

  2. Field: Organization (your custom field), Condition: equals, Value: e.g. Acme.

Account cannot be used in a Work item fields condition on Forge. To check that Account is empty, use a JQL condition instead, e.g. Account IS EMPTY.

3. Set the Account

  1. Select Add component > New action > Edit work item.

  2. Select More options (advanced field editing).

  3. In Additional fields, enter:

JSON
{
  "fields": {
    "Account": {
      "id": "35"
    }
  }
}

Replace 35 with the Tempo Account ID. You can use the custom field ID instead of Account, e.g. "customfield_XXXXX".

4. One branch per value

To cover several values, use If/else blocks (one per value), each with its own Edit work item JSON using the matching Account ID.

Organization

Tempo Account

Account ID in JSON

Acme

ACME

35

Globex

GLBX

36

5. Name and turn on the rule

Name it (e.g. Set Account from Organization) and select Turn it on.

Validate

  1. Create a work item in the project with Organization = Acme.

  2. Confirm the Account field is populated.

  3. Check the rule Audit log for errors.

  4. Log time and confirm the worklog appears under the Account in Tempo reports.

If the Account does not populate, test with the Account key instead of the numeric ID in the JSON.

Limitations and notes

  • Changing the Account on a work item also changes it on existing worklogs of that work item. See Account Field vs the Account Work Attribute.

  • Subtasks do not inherit Account. To copy from a parent, use {{issue.parent.Account.id}} as the id value in the JSON.

  • Jira Automation shows only the first 1000 Tempo Accounts in the field picker (Atlassian AUTO-439). Setting the value through JSON avoids this.

  • This sets the Account field only, not the Account work attribute on worklogs.

  • For Jira Automation questions, please contact Atlassian Support.