Loading Javascrpt into .VM for Workflow Parameters

I am trying to write a workflow post-function that will provide a select list of options pulled from a REST call to an external system. My struggle is how to include the Javascript into the .vm for the .vm that manages the input parameters. Since this .vm is embedded by Jira into its page, I can’t place

$webResourceManager.requireResourcesForContext(“conf-create-postfunction")

into the <HEADERS> block. When I place it into the body it just prints the webResource… line - Velocity won’t execute it to bring in my JS file

I am sure this is possible, but I can’t seem to figure it out. Help!?

You could try it using requireResource instead of requireResourceForContext. This would be something like: $webResourceManager.requireResource("{YOUR PLUGIN KEY}:conf-create-postfunction").

But before that, have you declared a web-resource in your atlassian-plugin.xml or are you trying to call your javascript directly? If you haven’t you should include something like:

<web-resource key="conf-create-postfunction" name="Your Resource Name">
    <resource type="download" name="file.js" location="js/file.js"/>
</web-resource>

When I created the plugin structure, it automatically created the web-resource and context for it in my atlassian-plugin.xml file and it created an empty .js file. I assumed that it would load this automatically as well, but it doesn’t see to do that.

The Velocity template doesn’t seem to process the $webResourceManager reference. It simply prints it out. The .vm is only partial and is automatically inserted into the Jira-provided post-function parameter page.