How can I use external JS resource in .vm file of a custom field plugin?

Muhammad Fahad February 28, 2018

I've followed a tutorial for creating a custom field via: https://developer.atlassian.com/server/jira/platform/creating-a-custom-field-in-jira/

And, now I want to use an external JS resource in my custom field. I can use an inline JS script though. But, for external JS resource I already looked into many of the answers as well as other resources too and I can't find a solution for that.

BTW, I'm using ATLAS Version: 6.3.4 and AMPS Version: 6.3.6 and my plugin is deployed on JIRA 7.5.0 for testing purposes and my target JIRA version is 7.3.8.

Anyone with a valid solution will be highly appreciated!

 

Below are few answers I've looked into:

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-include-javascript-and-css-file-in-vm-file/qaq-p/504812

https://community.atlassian.com/t5/Answers-Developer-Questions/Help-How-to-import-the-js-in-a-vm-file/qaq-p/525167

1 answer

0 votes
Anastasia April 7, 2020

For future reference,

I found that in order to bring a web resource which includes JavaScript, CSS, etc. resources, you need to add the

<context>atl.general</context>

for the general JIRA environment (except for the Administration panel). For the Service Desk portal, I also used:

<context>servicedesk.portal</context>  
<context>customerportal</context>

You can find more here: https://developer.atlassian.com/server/jira/platform/web-resource/#web-resource-contexts

Suggest an answer

Log in or Sign up to answer