Populate custom field using jira automation

Andre Menezes October 24, 2024

Hello team,

 

I have a few single select drop-down custom fields, which I would like to populate based on a description.

 

So, for example, if the description contains, [ABCD], I would like to populate the custo field A with ABCD and so forth.

 

What is the best way to do it? 

4 answers

2 votes
Tobias H
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.
October 24, 2024

Hello @Andre Menezes!

I guess you could do it something like this:

When issue created
IF Field Description contains "ABCD"
THEN Edit issue
* Choose field ABCD Select list
* Set value of field to ABCD

ELSE IF Field Description contains EFG
THEN .... set field EFG

Screenshot 2024-10-24 200239.png

1 vote
Bill Sheboy
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.
October 24, 2024

Hi @Andre Menezes 

First things first: as you are trying to parse several fields out of your Description, I recommend experimentation to solve and validate this scenario...

  • Create a test rule with a scheduled trigger and JQL, looking only at one test issue
  • Extract the values from the Description using text functions, and write them to the audit log
  • Once you have that all working, try using the Edit Issue action to edit the fields
  • Once that is working, change the rule trigger to Issue Created, and...
    • Add the Re-fetch Issue action after the trigger to prevent race-track / timing errors with the trigger
    • Consider if you need to handle other cases, such as:
      • edits to the description
      • manual changes to the decoded fields
      • missing fields in the description, so use default values
      • etc.

 

For your multiple-select option field, your parsing will need to create JSON, dynamically, to select the field values: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Multi-select-custom-field

That may be done using conditional logic, and perhaps even created variables.

 

To get you started on creating your rule, please refer to these documentation and example sources:

 

Kind regards,
Bill

0 votes
Sarah Schmitt-Bär (Seibert Group)
Atlassian Partner
October 25, 2024

Hi @Andre Menezes ,

if you don't want to set up Jira Automations, you could take a look at some Marketplace apps which lead you to the same result (and need less configuration).

Templating.app for example allows you to modify the Create Screen in various ways, including populating (multi-)select fields based on conditions. 

Here's how the configuration looks like for a rule "If description contains "customer", then select option 1 & 2 for the multi select field."

Bildschirmfoto 2024-10-25 um 11.23.20.png

You can add multiple conditions and modifications for different projects and issue types. As you can see, this is really handy. 

If you have any questions, please reach out. I'm the Product Manager of Templating.app, so I'm happy to help 💜

Cheers,

Sarah 

 

0 votes
Andre Menezes October 24, 2024

Perfect. Thanks, @Tobias H , how about a multi-select field? Do you have any ideas? Or this same approach should work?

Tobias H
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.
October 24, 2024

It works the same, but you wouldn't be able to do multiple selections at the same time without writing if-else statements for all the scenarios, as the edit issue uses "Set" instead of "Add".

It could perhaps be possible with using JSON to do Value add instead, but that is not my forte so I am not sure.

Suggest an answer

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

Atlassian Community Events