I have passed a List from Java to Velocity templating. Later (in Velocity) I loop through the list of items and create a Javascript object as follows:
<script>
var objectsForSelection = {};
#foreach($carrier in $TableConfigList)
#if(${carrier.getHtmlTemplate()}=="")
#set($jsonDescriptorWithHtml =${carrier.getJsonTemplateList().toString()})
objectsForSelection['$carrier.getOption()'] ={};
objectsForSelection['$carrier.getOption()']['fields']=JSON.parse('$jsonDescriptorWithHtml');
#end
#end
</script>
This script however is only executed when:
- The issue is created in a new page, or
- Create Issue window opens on a screen containing the customfield plugin;
Therefore the question is:
How can I pass data from velocity context to Javascript, and bind the data when the screen containing the Customfield is loaded?