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

Aleksey Ortukov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 25, 2022

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

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 25, 2022

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