Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Field dependencies

Shailesh Srivastava April 6, 2022

Requirement is that I have two fields. Transition will happen from "to do" to "In progress" if

a. first field is not empty

b. if first filed is filled with "Not Applicable" then second field should not be empty

 

How can we achieve in Jira

2 answers

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
April 6, 2022

Hi @Shailesh Srivastava 

This isn't possible natively using Validators - you'd need to look for an App which can enrich the Validators on offer, allowing for If/Else rules, etc.

There's a range of good Workflow Apps which have these types of extensions - see these listed on the Marketplace.

There are alternatives though!

 


Have you tried using Conditions?

A Condition dictates whether a transition is available or not - unlike a Validator, which requires an action to happen for it to be successful. See more information on this help page.

Conditions do allow for If/Else and And/Or rules - so, to create your requirement above, go to the Conditions tab on your Workflow and then...

  • Press Add Condition
  • Choose Value Field
  • For the first rule...
    • Add the first condition - Field 1 != <<EMPTY>>
    • Back on the Condition summary screen - hover over your first condition, and press the Grouped Condition icon - which is an arrow splitting into two
    • Add a second Value Field condition - Field 1 != N/A
    • These two conditions will appear as a group (in a little indented table). On the drop-down in this table, change the option to All of the following conditions
  • For the second rule...
    • Press the main Add Condition hyperlink again, and select Value Field
    • Add the condition - Field 1 = N/A
    • As above, add a Grouped Condition
    • Add a second Value Field condition - Field 2 != <<EMPTY>>
    • As above, set the rule to be All of the following conditions
  • Finally, outside of the indented tables, in the main table's drop-down, set the rule to Any of the following conditions

Publish the Workflow, and this should limit the transition's availability based on your requirements.

 


If it must be a validator, and an App isn't an option, I'd look to do this using...

  • A custom field, to capture when this this logic is met
  • A validator, to ensure field is populated
  • Automation, to populate/nullify the field

This would allow you to create the functionality of an If/Else validator. The field would be correctly populated using your logic on each occasion - and you're using that field's value to decide whether the transition is available or not.

---

This might look like this...

  • Create a checkbox Custom Field - such as Transition Available - with one option, "Yes". Do not add the field to any screens
  • Create the Field Required validator on your workflow transition for the new field

 

  • Create an Automation Rule, for example...
    • Trigger: Issue Updated
    • Condition: Issue Fields Condition - Status = To Do
    • Condition: If/Else Block...
      • If...
        • Sub-Condition: Issue Fields Condition
          • Field 1 is one of all values aside from N/A
        • Sub-Action: Edit Issue
          • Populate Yes on Transition Available
      • Else-If...
        • Sub-Condition: Issue Fields Condition
          • Field 1 = N/A
        • Sub-Condition: Issue Fields Condition
          • Field 2 is not empty
        • Sub-Action: Edit Issue
          • Populate Yes on Transition Available
      • Else...
        • Sub-Action: Edit Issue
          • Remove value from Transition Available

 


^ You could also use the rule to auto-transition the Issue if preferred.

Let us know if one of these options works for you!

Ste

Shailesh Srivastava April 6, 2022

Thank you Stephen for detailed steps.

I tried the steps using "Conditions" as explained above. Somehow for me the "Add Group Conditions" icon is inactive (greyed out). Do i need to do any step to make it active. Please suggest.
Attachment is for our reference.

Transition_Validation1.jpg

Ste Wright
Community Champion
April 6, 2022

Hi @Shailesh Srivastava 

Strange! I tried this, and found if you add a second condition it becomes available. Could you try this to see if it works in your instance?

Just to clarify on the condition setup from the screenshot above...

  • Field: This is the field the rule is aligned to
  • Condition: This is equals, not equals, etc
  • Value: If this is <<EMPTY>> - leave it blank, rather than entering that text

Ste

Shailesh Srivastava April 7, 2022

Thanks Stephen.
Yes. If I add second condition, it (add group condition) becomes active.

 

Also, I would like to say, "many Thanks Stephen". I was able to implement the requirement per the steps suggested by you. I tried "Conditions". After implementation, I tested in my personal Jira instance and it worked.

Like Ste Wright likes this
Ste Wright
Community Champion
April 7, 2022

Excellent! Glad it worked :)

Ste

0 votes
Shailesh Srivastava April 6, 2022

Well , I achieved the 1st case i.e. transition will not happen when if first field is empty. I used transition validator to achieve that. However getting stuck in solving second logic i.e. if first filed is "Not Applicable" then second field should not be empty

Suggest an answer

Log in or Sign up to answer