Forums

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

Simple script failing? Need help

Wesley Stewart
June 28, 2021

I am trying to figure out what I think is a simple issue.  I am trying to create a restAPI using scriptrunner, and simply dump the data from a JQL.  I almost have it working I believe...

 

However, this returns a blank page...

def jql= "project = Project1"

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService)
def searchProvider = ComponentAccessor.getComponent(SearchProvider.class)

def query = jqlQueryParser.parseQuery(jql)
def results = searchService.search(user,query, PagerFilter.getUnlimitedFilter())
helpdeskActiveAgent(httpMethod: "GET", groups: ["Scriptrunner Access Group"]) { MultivaluedMap queryParams, String body ->
return Response.ok(
results.results
).build();
}

 

However, instead of using results.results or results.getResults(), and I use results.total, I get a valid answer [314].  However when trying to figure the JQL results, I get null.

 

Ultimately just trying to learn.  Any help appreciated!

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Alejandro Suárez García
Atlassian Partner
October 3, 2019

@siva yes, is quite easy tbh.

siva
Contributor
October 4, 2019

@Alejandro Suárez García 

Thanks for the response,

I need the script for the postfunction for adding two date fields so i can add the sum in the second date field.

THEN i need to add a number field to date field ( TARGET REQUIREMENT)

TAGS
AUG Leaders

Atlassian Community Events