Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,117
Community Members
 
Community Events
165
Community Groups

Сheck the field value from the task with the field value on the edith screen

Hi! There was a question.
There are two fields. When changing the value in the first, the value in the second should be deleted.

The following came to mind:

create a script that will check the field value from the task with the field value on the edith form and if they are not equal then the values in the second one will be deleted

1 answer

Hi @Aleksey Ortukov

In your description, you mentioned:

The following came to mind:

create a script that will check the field value from the task with the field value on the edith form and if they are not equal then the values in the second one will be deleted

In other words, when you open the edit screen, if values in the first list don't match the second list, you want the second list to be reset. Is this correct?

If so, you can use the Behaviour to reset the value of the second list on the Edit screen.

Below is a sample code for your reference:-

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours

def sampleList1 = getFieldByName('Sample List')
def sampleList1Value = sampleList1.value.toString()

def sampleList2 = getFieldByName('Sample List 2')
def sampleList2Value = sampleList2.value.toString()

if (underlyingIssue && sampleList1Value != sampleList2Value ) {
sampleList2.setFormValue('-1')
}

Please note, this sample code is not 100% exact to your environment. Hence, you will need to modify it accordingly.

Below is a print screen of the Behaviour configuration:-

behaviour_config.png

If you observe the print screen above, the Behaviour is configured in the Initialiser to trigger the moment the Edit issue screen is loaded. 

For more information, you can visit the Adaptavist Documentation

I hope this helps to solve your question. :)

Thank you and Kind Regards,

Ram

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

248 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you