Forums

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

Date value should be selected after X days if I select a value in above dropdown field

Ajaygoud Gaddam
April 28, 2022

We have Location field as drop-down field and date field. here we need if I select value XXX from Location the date field should be selected after 10 days and If I select YYY in the location the date field should be selected as 5 days after the current date. 

We are using JMWE any script can be shared which suits for this condition

Thanks,

Ajay

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Joshua Yamdogo @ Adaptavist
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 Champions.
May 8, 2018

Valerie,

Have you made sure that this script is NOT being used in an initializer of the behaviour? You need to attach this script to a field, e.g. description. From our docs: "This script hinges on the parentIssueId being present in the form. As such, you will need to associate the script with a visible field. It will not work as an initialiser."

Regards,

Josh

Valerie Rouda
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!
May 9, 2018

Correct.  The script is attached to a field on the screen, not used as an initializer.  I was able to get non-custom fields like assignee to work, but was getting inconsistent results for the custom field unfortunately.   I ended up finding another solution since I couldn't get this to work. 

Joshua Yamdogo @ Adaptavist
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 Champions.
May 9, 2018

Hi Valerie,

I'm sorry to hear that!  If you're still interested in trying to make it work, I have some questions for you that might help me try to think of a fix.

You mentioned you want to set a custom field that is a drop-down. Is this a standard custom field, as in the standard Select List custom field in Jira? Or does this drop-down field come from another plugin?

Which version of ScriptRunner are you on? I see you're trying to use one of the examples in our documentation here: https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/subtask-default-fields.html

Your code has a logging statement 

log.debug("parentValue: ${parentValue?.class} for type ${cf.name}") 

You might look in the atlassian-jira.log and see what's being logged. That might give us some clues as to what's going wrong.

Regards,

Josh

TAGS
AUG Leaders

Atlassian Community Events