Hi Team,
We have a requirement to change the custom field values in the dropdown depending on the workflow status.
For example :
Hi @jira_admin_cu
Could you please clarify if you are using a Transition screen? I am asking this because if you intend to filter the List's option, this can only be done using ScriptRunner's Behaviour.
However, a transition screen will be required if you want the filtration to occur according to the transition type.
You can use the Behaviour Initialiser to trigger the filtration.
Below is a sample working code for your reference:-
import com.onresolve.jira.groovy.user.FieldBehavioursimport groovy.transform.BaseScript@BaseScript FieldBehaviours behavioursdef sampleList = getFieldByName('Sample List')def options = []if (actionName == 'In Progress') { options = ['Option1', 'Option2']} else if (actionName == 'Done') { options = ['Option3', 'Option4']}sampleList.setFieldOptions(options)
Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot of the Behaviour configuration for your reference:-
You will need to add the Transition screens to your Workflow accordingly and ensure the list is included in it.
I hope this helps to solve your question. :-)Thank you and Kind regards,
Ram
Hello, Good day. Jira don't have this option builtin. You can explore addons like script runner. https://community.atlassian.com/t5/Jira-Software-questions/How-to-show-custom-field-in-specific-statuses-only-hide-the-rest/qaq-p/1816591
Hello @Mohanraj Thangamuthu ,
That's not my requirement. I want to update custom field values based on status.
Hi @jira_admin_cu ,
Thanks for posting your question here!
It's easy, just try out Jira Automation for this or you can even use Post function in Jira.
Simply add a rule like this :
You can explore the automation rule to change the field value based on issue status.
Hi @Ram Kumar Aravindakshan _Adaptavist_. Thank you for your quick response. The script works, and the field options are displayed on a particular transition based on the filter (I added a transition screen). Still, when creating the ticket, the field does not show any value; when editing the field in that particular status, the field does not show any value. Please find the attached screenshot for your reference.
The script is :
Field on Create and edit the field to other value on particular status.
On Create, It should display all values.
On Edit, It should display the filtered values only if the ticket is in that particular status.
Is it possible. Could please suggest me?
I'm not sure why it's not working on your side; it's working fine on mine.
Below are a couple of test screenshots for your reference:-
1. When transitioning to the In Progress status, the options in the Sample List field are filtered to Option1 and Option2 and shown in the screenshot below:-
2. When transitioning to the Done status, the options in the Sample List field are filtered to Option3 and Option4.
Please try to disable all your third-party plugins except for ScriptRunner and try to rerun the test. I am suggesting this because, in my environment, I am only using the ScriptRunner plugin to rule out if there are any conflicts with the plugins resulting in the problem you are encountering.
I am looking forward to your feedback.
Thank you and Kind regards,Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_ ,
No, This piece is perfectly working on the status transitions (I added them to the transition screen).
What I am asking is,
Field on Create and edit ,
On Create, It should display all values, but it is showing "None" (as per my screenshot above) while creating the new ticket.
On Edit, It should display the filtered values only if the ticket is in that particular status (in Progress or Done), but it is showing "None" (as per my screenshot).I was able to display all custom field values on "Create", but when we are editing the field, its still showing "None" instead of the filter values.
It looks like you're new here. Sign in or register to get started.