Hi Community,We have a lot of configured scheduled Assets imports running everyday several times due dayIf we need to disable them temporarily - we would like to avoid going through dozen of ObjectSchemas and disable manually more then hundred of importsquestion is: is there a possibility to disable them all at onceI tried to use class com.riadalabs.jira.plugins.insight.channel.external.api.facade.ImportSourceConfigurationFacade:
import com.onresolve.scriptrunner.runner.customisers.PluginModuleimport com.onresolve.scriptrunner.runner.customisers.WithPluginimport com.onresolve.scriptrunner.db.DatabaseUtilimport com.riadalabs.jira.plugins.insight.channel.external.api.facade.ImportSourceConfigurationFacade@WithPlugin('com.riadalabs.jira.plugins.insight')@PluginModule ImportSourceConfigurationFacade importSourceConfigurationFacade//getting list of all imports from database directly
DatabaseUtil.withSql('Imports') { sql ->// going through each row of defined SQL query sql.eachRow("""SELECT SRC.NAME, SRC.ID FROM JiraDB.jiraschema.AO_8542F1_IFJ_IMPORT_SRC AS SRC ORDER BY SRC.ID ASC""") { def importID = it.getAt('ID') as Integer //Import ID def importSource = importSourceConfigurationFacade.loadImportSource(importID) def disabledImportStatus = importSource.importSourceStatus.createDisabled() importSource.setImportSourceStatus(disabledImportStatus) //log.warn(importSource.importSourceStatus) log.warn("Import Name: "+importSource.getName()+"; Import ID: $importID; Enabled: "+importSource.isEnabled()) }}
Script is running and giving goal result for ImportSourceStatus = falsebut imports remains enabled in UI and in DB
The importSource only exists in memory within the script context
You have to store it back after setting the status.
importSourceConfigurationFacade.storeImportSource(importSource)
It seems like the script is correctly updating the import status in the database, but it's not reflecting in the UI. Ensure that you're committing the changes to the database after updating the import source status to ensure they take effect.
Thanks,I missed that somehow. It works nowAdded this command and condition for importSource.isEnabled() not to update every import objects
deleted
Just to add for future references:We found out that there is hidden PUT API request can be used to disable imports:https://{JIRA-URL}/rest/insight/1.0/importsource/{import_ID}/disable
It looks like you're new here. Sign in or register to get started.