i want to export issues details automatically to google sheet based on JQL on a special time trigger for example export issues automatically on a daily basis
Hi @mahdi shirgholami I am not sure how to do it on google sheet. But in MS Excel you can do it via JQL REST API
Get Data in Excel from Web > enter JIRA jql get request. In Power Query editor select the fields which you want add as column.
thanks for your answer vikrant, you mean to do it with scriptrunner?
i tried this script but i get some errors and don't know how to deal with it
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchRequest
import com.atlassian.jira.issue.search.SearchRequestManager
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.user.ApplicationUser
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import com.atlassian.jira.util.json.JSONObject
import com.atlassian.jira.web.bean.PagerFilter
@WithPlugin("com.atlassian.jira.plugins.jira-importers-plugin")
@PluginModule
CustomEndpointDelegate customEndpointDelegate
def jiraAuthenticationContext = ComponentAccessor.getComponent(JiraAuthenticationContext)
def searchRequestManager = ComponentAccessor.getComponent(SearchRequestManager)
def currentUser = jiraAuthenticationContext.loggedInUser
def savedFilterId = 12345 // Replace with the ID of your saved filter
def cronExpression = "0 0 * * * ?" // Schedule for daily export at midnight
// Function to create a scheduled export
def createScheduledExport() {
def savedFilter = searchRequestManager.getSavedFilter(currentUser, savedFilterId as Long)
if (savedFilter) {
def endpointUrl = "/rest/api/2/filter/${savedFilter.id}/export"
def requestBody = new JSONObject([
"cronExpression": cronExpression,
"enabled": true
])
def response = customEndpointDelegate.post(endpointUrl, JsonOutput.toJson(requestBody))
if (response.status == 200) {
return "Scheduled export created successfully."
} else {
return "Failed to create scheduled export."
}
} else {
return "Saved filter with ID $savedFilterId not found."
}
}
// Call the function to create the scheduled export
def result = createScheduledExport()
return result
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.