Populate custom textfield based on select list selection

Bastian Breindl February 28, 2018

Hi,

 

The situtation is as follows:

When I create a new task/issue, I need to automatically fill a text field in the creation mask based on a select list selection in the same mask.

For example: My Select List custom field is called 'Version'  and the Textfield (multiline) is called 'Release'.  Now, when I create a new task I want to automatically add a specific text to 'Release' based on my selection in 'Version'. This has to happen while still beeing in the creation mask and not as post function, since both fields are mandatory.

 

Thanks in advance!

2 answers

1 vote
Nic Brough -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.
February 28, 2018

You could do this with the Behaviours module in ScriptRunner.

(As an aside, I'm not sure why this is of any possible use when you've got the version already.  There's no need to duplicate it)

Bastian Breindl February 28, 2018

Maybe my explanation wasnt clear enough. Version was just an example.

An actual use-case for us would be:
We have a Select List field called 'Task type' in which you select one of 10 possible task types for this issue. 
Based on the task type we want to automatically fill a text field in the same mask (creation mask).  Lets say you pick Task type: 'Software test', then I want the textfield to be populated with "This task relates to software testing" for example.

Do you have any suggestions on how the script to do this would look like?

Thank you very much!

0 votes
Bastian Breindl March 6, 2018

I was hoping to get it done with something like this in the description field of the select list:

<script type="text/javascript">
aufgaben = document.getElementById('customFieldId=10521');

if(aufgaben) {
target = document.getElementById('customFieldId=10525');

aufgaben.onchange=function() {
if (this.value == '10_LION-Webapplikation') {
target.value="Test";
}
}
}

</script>

Suggest an answer

Log in or Sign up to answer