how to use sqlprocessor or ao in javascript

Hi Friends,

I have created webresource plugin module to remove issuetypes in javascript I want to retrive jira database values using sqlprocessor or ao,

How would I use database values in IssueTypesResctictor.js ?

atlassian-plugin.xml***********************************************************

<web-resource key="IssueTypesRestrictor-js" name="javascript">
        <dependency>jira.webresources:global-static</dependency>
        <description>JavaScript</description>
        <resource name="IssueTypesRestrictor.js" type="download" location="js/IssueTypesRestrictor.js" />
        <context>atl.general</context>
         <context>atl.admin</context>
</web-resource>

IssueTypesResctictor.js***********************************************************

jQuery(document).ready(function($) 
{
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
    hide();
});
hide();      
function hide()
	{
        $("#issuetype option").each(function()
        		{              
                	if($.trim($(this).text()) == 'Bug')
                	{
                		$(this).remove();
                	}
        		});
	}
});

***************************************************************************

Thanks in advance

&

Best Regards

Onkar Ahire

2 answers

1 accepted

Accepted Answer
0 votes

create your own rest api using REST plugin module and implement all you logic in that rest

so later you can call that rest in javascript file

check this for rest plugin module

https://developer.atlassian.com/display/DOCS/REST+Plugin+Module

@Rambanam as you said to use rest api , can we retrive db values in restapi ?

yes, you can retrive db values using JDBC or by using JNDI configuration.

0 votes
Mizan Community Champion Oct 14, 2013

It seems you are trying to hide certain issue types .

Good way to do is use behaviours plugin and write a groovy script .

Thanks Mizan I appriciate it is possible using groovy script and behaviour plugin, Above script is hardcoded.

I am writing a plugin which will save restricted issue types in database using project specific configuration(project-tab-panel) and while creating an issue it will run the above script and validate the restricted issue types which saved in database and remove that issuetypes from issuetypes field but seems it might not possible to use sqlprocessor or ao,

so moving a head I got an idea to write a plugin to extend the capabilities for creating issue, there I can use sql processor or ao at the time of validation and use addfielderror message if issue type is restricted for specific user/roles(restricted issue types will be saved in db as a configuration of project) but again here I stuck with https://answers.atlassian.com/questions/222470/extend-the-capabilities-for-creating-issue

Can anyone suggest solution?

Thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

34 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you