How to reference pluginSettings from all 3 places needed?

JIRA Plugin Development: Looking for a complete example of how to retrieve values that are configured via an admin UI. I have modeled after the Creating an Admin Configuration Form, and got it to persist after fixing the error-missing declaration of baseUrl in updateConfig (the .js file). But I have not been able to find any working examples of how to access those values later. For example, I want to configure a baseUrl to an external web API. I will later need to access that value to construct a complete URL from within all source file types: .java (crucial), .vm (this, I assume I can send from java via contextMap), as well as the .js (also crucial). Could someone please post the answer is great detail (not just a one line fragment, but entire files, or at least all imports, declarations, and a large enough code fragment to fully understand what is missing. So, this is effectively 3 questions, since I need to get the value from each of 3 file types within my plugin project. Many thanks!

I’d help, but I can’t satisfy the requirement for entire files etc. Just too busy these days.

If you are looking for working examples, I would recommend finding an open source add-on that does what you want and having a look at how they do it. Most of Atlassian’s tutorials have links to Bitbucket repos where there is a working example.

You might also be able to add a working module to your add-on automatically by using the atlas-create-refapp-plugin-module og atlas-create-confluence-plugin-module SDK commands.

It seems that the tutorials are out of date. They build, but the closest example was for version 3.5, and we are on 7.3. It also had an error. I bought the Cookbook, that was supposedly updated for JIRA 7.0, but while the text might have been revised, all the example code was still for version 6 or prior. Is there another ‘partner’ site besides the one published by Atlassian. I have contact NexGen and one other outfit, but they are also too busy to help. Thanks

Dear Steve,

I can not provide you a full working example, but I am sure with a few hints, you can find the solution by yourself:

For accessing the persisted settings, you us the same mechanism you used to store them: the SAL PluginSettings class. Just instead the put() you make a get(), see

About VM you are right, you just put the values you retrieved in you Java code into the ContextMap used to render your template.

About accessing the values in JS: Perhaps the easiest way is to implement a REST service, that provides the stored values as a JSON object.

Hope it helps.


Thanks, that could help. The only remaining problem with PluginSettings.get() was that the object was not initialized until after I had visited the admin page. this is likely my not understanding the Java architecture more than anything else. And the next thing I read to try was to store the values in hidden html elements I could later reference from the js through jQuery. Regards, Steve

You should consider adding your code so people can suggest changes, rather than supplying a full tutorial.

I like to add such things as data-xxx attributes of the body tag or some other well-known HTML element. I then grab those values using JQuery’s data('xxx') function (where xxx is some identifier of your own).

Found a solution that works so far:
Use Knockout and declare a viewmodel in the Javascript containing all needed observable form elements.
Add the data-bind attribute on the elements defined in the Velocity template.
Use AJS.$.getJSON and AJS.$.post to exchange and act the model through a rest API service written in Java.