Don't know if this 5 years old question is still actual
From within the JIRA gadget (OpenSocial one - i.e. pre 7.x JIRA) you can use this:
var gadget = AJS.Gadget({ ... view: { ... template: function (args) { ... var gadgetId = this.getPrefs().getModuleId(); ... } } ... });
From within the server side consider use DashboardService:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.