Forums

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

Filed required based on greater than condition

Devi Gattu August 18, 2024

Hi Team ,

 Need your help on script so I have custom fields called as "initiated by" drop down values are "issue Owner" and "JVm" and another custom field called as "closed date" and another field called as "review date" and another custom field called as "closure review date" so when user select issue Owner in "initiated by" field and user give "closed date" field is greater than "review date" then "closure review date" should be mandatory or else if "closed date" is less than "review date" then "closure review date" should be optional 

I tried with some script but it's could not help, could you please help with this task 

2 answers

2 votes
Ling Ng
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!
August 22, 2024

Hi Devi,

I was able to replicate your use case using ScriptRunner Behaviours. You may want to reference the script that I used here (https://bitbucket.org/Adaptavist/workspace/snippets/bqyz6R/scriptrunner-dc-behaviour-check-the-value).

Make sure you've also added each of the 4 fields in Behaviours.Screen Shot 2024-08-22 at 16.38.57 PM.png

Hope this helps! If you still can't get it to work - I would recommend you to open a Support Ticket with us for one of our Support Engineers to investigate and work with you.

0 votes
Hauke Bruno Wollentin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2024

I assume you are using ScriptRunner Behaviours for that?

Could you provide the script you have so far?  

Devi Gattu August 19, 2024

Hi @Hauke Bruno Wollentin 

 

Thanks for the quick reply,

I am sharing the code here, please check 

 

Devi Gattu August 19, 2024

Screenshot_20240819_165155.jpg

Hauke Bruno Wollentin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 19, 2024

Where did you place this code? You aren't using ScriptRunner Behaviours aren't you?

Also: anything in the logs? You also could try to add some debug logging in your if-statements to check if conditions are true or not.

Devi Gattu August 19, 2024

Hi ,

 

I have placed in script runner behaviour and I added debug log also so after the execution, it shows "no logs found in this execution".

Hauke Bruno Wollentin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 19, 2024

Another guess, do you use custom field translation? We ran into this and _thought_ that the custom field name will be the same for Behaviours. But in fact it is the translation based on the configured language of a user 😅

This is our solution so far:

switch (usersLocale) {

case "de_DE":
fieldName = "Beschreibung"
break

case "it_IT":
fieldName = "Descrizione"
break

default:
fieldName = "Description"

}

def field = getFieldByName(fieldName)

 While "usersLocale" comes from com.atlassian.jira.user.UserLocaleStore

Also I'm not sure about the "@BaseScript" decorator you are using. I can't find this in the documentation, also we aren't using it as well.

But in general your script _should_ work

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.12.7
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events