The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

how to use sqlprocessor or ao in javascript

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 14, 2013

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 14, 2013

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

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 14, 2013

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

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 14, 2013

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

0 votes
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 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 .

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 14, 2013

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

TAGS
AUG Leaders

Atlassian Community Events