How to clear out the field values when the Issue Type of an issue gets changed using Automation for Jira(A4J)

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Clearing out the field values like Sprint, Story Points, etc. whenever there is a change in Issue Type, for example, Story changed to Epic.

Solution

1. Create an Automation Rule with a Field Value Changed trigger.

Field value changed trigger

2. To compare the previous value of issue type from the issue, let's add a condition using Advanced Compare Condition

For Example- The issue Type changes from Bug to Story

Use the below smart value for the "First Value" of the condition which holds the previous value of the Issue Type.

1 {{fieldChange.fromString}}

Compare using the 'Contains' condition against the second value.

Advanced compare condition

In case of multiple conditions that need to be placed. For example- To clear the Sprint (or Story Points) field value when the Issue Type changes from "Bug" Or "Story" to "Task", use the "Contains Regular Expression" condition as below.

Reference screenshot

3. Add another component that is Issue Fields Condition, which holds the value of the Issue Type that got changed.

4. Finally, clear the sprint (or Story Points) field value using the Edit Issue action. To do it:

a. First, select the list of field(s) that you are trying clear:

Select the fields you want to clear

b. Then don't add any value to these fields. Without specifying any value, the fields will be cleared out:

Do not add any value like shown below

5. Verify the audit log and the Issue view that the Sprint field value is cleared out.

Check for result in audit log

Updated on June 6, 2024

Still need help?

The Atlassian Community is here for you.