Populate custom fields automatically

How to automatically populate Discord-related custom fields when tickets are created from Discord

Introduction

When users create tickets from Discord, you may want to automatically capture and store Discord-specific information such as the user’s Discord name, server ID or the ticket thread link. This guide will walk you through:

  1. Creating custom fields to store Discord information
  2. Adding these custom fields to your request types
  3. Configuring Jira automation rules to automatically populate these fields

Creating Custom Fields for Discord Information

First, you’ll need to create custom fields to store Discord-related information. Common fields include:

  • Discord User Name
  • Discord Thread Link

For detailed instructions on how to create custom fields and add them to your request types, please refer to our Adding custom fields to tickets guide.

When creating fields for Discord information, use these recommended field types:

  • For Discord User Name: Choose Text Field (single line)
  • For Discord Thread Link: Choose URL Field
  • For other Discord IDs: Choose Text Field (single line)

Here’s how these custom fields should look in your request type configuration when added properly (You can add them also as context fields, up to you)

Configuring Jira Automation Rules

Once you have created custom fields and added them to your request types, you can set up automation rules to populate these fields automatically when tickets are created from Discord.

Setting Up the Automation Rule

To automatically populate Discord custom fields when tickets are created, you’ll need to create a simple automation rule:

  1. Navigate to your project settings > Automation and click Create rule
  2. Name your rule (e.g., “Set Discord Fields on Issue Creation”)
  3. Configure the rule as follows:
    • Trigger: Select “Issue created”
    • Condition: Add an “Smart Values” condition and check that {{issue.properties.discord-for-jira-discord-thread-id.value}} is not empty (this ensures the rule only runs for tickets created from Discord)
    • Action: Add an “Edit issue” action that sets values for your custom fields (see screenshot below for exact syntax)

Here’s how your completed automation rule should look:

The screenshot shows the exact syntax for the field values. For reference, here are the expressions to use:

  • Discord User Name: {{issue.properties.discord-for-jira-discord-user-name.value}}
  • Discord Thread Link: https://discord.com/channels/{{issue.properties.discord-for-jira-discord-server-id.value}}/{{issue.properties.discord-for-jira-discord-thread-id.value}}

Review your rule configuration and click Turn it on to activate it

The screenshot above shows the final configuration with both the trigger condition and the field mapping actions properly set up.

Available Discord Properties

When a ticket is created from Discord, the following properties are available for use in your automation rules:

{
  "discord-for-jira-discord-server-id": "The Discord server ID where the ticket was created",
  "discord-for-jira-discord-channel-id": "The Discord support channel ID under which the ticket thread was created",
  "discord-for-jira-discord-thread-id": "The Discord ticket thread ID",
  "discord-for-jira-discord-user-id": "The Discord user ID of the person who created the ticket",
  "discord-for-jira-discord-user-name": "The Discord username of the person who created the ticket"
}

Testing Your Automation

After setting up your automation rule:

  1. Create a new ticket from Discord using the /create command or ticket panel
  2. Check the created Jira issue to verify that your custom fields have been populated correctly

Troubleshooting

If your custom fields are not being populated correctly:

  1. Check that the issue property condition is correctly configured
  2. Verify that the smart values in your actions are using the correct property keys
  3. Ensure that the Discord properties are being set on the issue (you can check this by navigating to https://YOUR_JIRA_INSTANCE.atlassian.net/rest/api/3/issue/ISSUE_KEY/properties URL, and then to particular property values)
  4. Review the automation rule Audit log for any errors

Conclusion

By using Jira automation with Discord custom fields, you can capture important context about where and who created the ticket, which then can be used further in more advanced automation scenarios, or for reporting purposes.

Remember that you can extend this automation to include additional actions, such as:

  • Setting other fields based on Discord information
  • Sending notifications based on Discord information

Pro tip: You can use these automation rules in combination with other Jira automation features to create powerful workflows that streamline your support process.


Add custom fields to tickets
Filter notifications with JQL