Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Automatic Asset Export Using Java API

Edited

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

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.")
}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events