Capture information from Description and populate custom field

Andre Menezes February 7, 2024

Hey all,

 

I am trying to capture information from the description and populate a custom field.

 

I am using the syntax below, but it is not working 

 

{{issue.description.match("Slack Thread:(\d+).*")}}

 

The information on the description is:

 

Slack Thread: 1238787abceft

 

1 answer

0 votes
Ignacio Aredez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 7, 2024

It seems you are on the right path by attempting to use smart values and regex (regular expressions) to extract specific parts of the text. However, if the provided syntax is not working as expected, let's review and adjust the approach:

 

  1.   Understanding the Syntax and Issue:   The syntax `{{issue.description.match("Slack Thread:(\d+).*")}}` is designed to capture a sequence of digits (`\d+`) following the specific text "Slack Thread:". If it's not capturing the expected value, the issue might be with the regex pattern or how the captured value is being used.

 

  1.   Adjusting the Regular Expression:   The regular expression you've provided should technically match a sequence of digits following the "Slack Thread:" text. However, if your actual Slack Thread ID includes letters (as shown in your example `1238787abceft`), the `\d+` part of the regex will only match digits and ignore the letters. To capture both letters and digits, you should adjust the regex to include alphanumeric characters.

 

  1.   Updated Syntax:   To capture alphanumeric characters (both letters and digits), you can use the following adjusted syntax:

   ```

   {{issue.description.match("Slack Thread: ([a-zA-Z0-9]+).*")}}

   ```

   This pattern `([a-zA-Z0-9]+)` is designed to match any combination of letters (`a-zA-Z`) and digits (`0-9`).

 

  1.   Implementing the Change:  

   - Ensure that you are placing this syntax in the appropriate automation rule in Jira Cloud.

   - In the rule, after capturing the value, you need to set the action to "Edit issue" and populate the custom field with the captured value. Make sure the custom field is designed to accept the type of data you're extracting (text string in this case).

 

  1.   Testing and Verification:  

   - After implementing the adjusted regex, test the automation by creating or updating an issue with a description that includes a Slack Thread ID as described.

   - Verify that the custom field is populated with the expected value.

 

  1.   Troubleshooting:  

   - If the custom field is still not being populated, check the automation rule's audit log to identify any errors or warnings.

   - Ensure that the automation rule has the necessary permissions to edit issues and modify custom fields.

 

Remember, regular expressions can be quite specific, and even minor discrepancies between the expected pattern and the actual text can cause mismatches. If further adjustments are needed, consider the exact format of the Slack Thread IDs you're working with and adjust the regex accordingly.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events