Export assets automatically

Wanting to know if anyone has got a way to export assets automatically.

Probably not quite the right forum, but have been struggling with this, i am using Data center LTS 9.4.11 and have scriptrunner.
Idea was to get the code working in script console first then change into a “Job”

Error: 2023-11-07 00:49:35,938 ERROR [runner.ScriptBindingsManager]: Export data is null.

Attempted code so far:

import com.onresolve.scriptrunner.runner.customisers.PluginModule

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ConfigureFacade

import com.riadalabs.jira.plugins.insight.services.imports.model.schema.ExportObjectSchemaDataBean

import com.riadalabs.jira.plugins.insight.services.progress.result.ProgressResultBase

import com.riadalabs.jira.plugins.insight.services.progress.result.ProgressResult

import org.apache.log4j.Logger

import org.apache.log4j.Level

@WithPlugin(‘com.riadalabs.jira.plugins.insight’) insightPlugin

// Define the export configuration

String fileName = “FileName.zip”; // Specify the file name

Integer objectSchemaId = 1; // Replace with the actual object schema ID

String objectSchemaName = “Model Name”; // Replace with the schema name

boolean includeObjects = true; // Set to true to include objects

// Create an instance of ExportObjectSchemaDataBean

ExportObjectSchemaDataBean exportDataBean = new ExportObjectSchemaDataBean(

fileName,

objectSchemaId,

objectSchemaName,

includeObjects

);

// Inspect the methods and properties of the ExportObjectSchemaDataBean object

def methods = exportDataBean.getClass().getMethods()

def properties = exportDataBean.properties

if (exportDataBean) {

def output = exportDataBean.getResult();

if (output) {

// The export data is now collected and can be saved to a file or processed further.

def exportFilePath = “/var/atlassian/application-data/shared-home/export/insight/FileName.zip” // Replace with the desired file path

new File(exportFilePath).text = output

} else {

log.error(“Export data is null.”)

}

} else {

log.error(“ExportObjectSchemaDataBean is null.”)

}