hi Felix, we have solved the issue. Thank you
This is my groovy code
import net.datenwerke.security.service.usermanager.UserManagerService
import net.datenwerke.rs.core.service.reportmanager.ReportService
import net.datenwerke.rs.scheduler.service.scheduler.jobs.report.ReportExecuteJob
import net.datenwerke.rs.core.service.reportmanager.ReportExecutorService
import net.datenwerke.rs.core.service.datasinkmanager.DatasinkTreeService
import net.datenwerke.rs.core.service.datasinkmanager.DatasinkService
import net.datenwerke.scheduler.service.scheduler.nlp.NlpTriggerService
import net.datenwerke.scheduler.service.scheduler.SchedulerService
import net.datenwerke.rs.localfsdatasink.service.localfsdatasink.LocalFileSystemService
import net.datenwerke.rs.localfsdatasink.service.localfsdatasink.action.ScheduleAsLocalFileSystemFileAction
import net.datenwerke.rs.base.service.reportengines.jasper.entities.JasperReport
import net.datenwerke.rs.base.service.parameters.string.TextParameterInstance
import net.datenwerke.rs.core.service.parameters.entities.ParameterInstance
import java.util.logging.Level
import java.util.logging.Logger
OWNER_ID = 6L // the ID of the Owner
EXECUTOR_ID = 6L // the ID of the Executor
RECIPIENT_IDS = [6L] // the IDs of the Recipients
OUTPUT_FORMAT = ReportExecutorService.OUTPUT_FORMAT_PDF
String localFolderPath = ‘./’
JOB_NAME = ‘Scheduling Job’
JOB_DESCRIPTION = ‘Report Scheduling Job’
LOCAL_DATASINK = ‘LocalFolder’
def userManagerService = GLOBALS.getRsService(UserManagerService)
def reportService = GLOBALS.getInstance(ReportService)
def datasinkTreeService = GLOBALS.getInstance(DatasinkTreeService)
def triggerService = GLOBALS.getInstance(NlpTriggerService)
def schedulerService = GLOBALS.getInstance(SchedulerService)
def datasinkService = GLOBALS.getInstance(DatasinkService)
def localfileSystemService=GLOBALS.getInstance(LocalFileSystemService)
def reportId = args[0].toInteger()//variant id
def report = reportService.getReportById(reportId) // get Report by ID
def owner = userManagerService.getNodeById(OWNER_ID)
def executor = userManagerService.getNodeById(EXECUTOR_ID)
def recipients = userManagerService.getUsers(RECIPIENT_IDS)
def reportName =report.getName()+‘-’+args[2].toString()
/* create new variant of the report */
def variantRpt = ((JasperReport)report).createNewVariant(report)
variantRpt.setName(reportName)
variantRpt.setKey(args[3].toString())
for (ParameterInstance instance : variantRpt.getParameterInstances()) {
((TextParameterInstance)instance).setValue(args[3].toString())
}
/* create the Report Job and add the corresponding owner, executor and recipients */
def job = new ReportExecuteJob(report: variantRpt, owners: [owner] ,executor: executor, recipients: recipients as List, outputFormat: OUTPUT_FORMAT)
/* Schedule as Local File System File Action */
def localFileDatasink = datasinkTreeService.getDatasinkByName(LOCAL_DATASINK)
def action = new ScheduleAsLocalFileSystemFileAction(localFileSystemDatasink: localFileDatasink, name: reportName,folder: localFolderPath)
/* add the description, version, actions etc. */
job.title = JOB_NAME
job.description = JOB_DESCRIPTION
job.actions = [action]
/* parse the date with nlp */
def dateExpression = args[1]
def trigger = triggerService.parseExpression dateExpression //DATE_EXPRESSION
/* schedule the job via the schedulerService */
schedulerService.schedule job, trigger
/* Logs */
tout.println('Job: '+job)
def prefix = “logger.groovy”
def logger = Logger.getLogger(getClass().name)
logger.log(Level.INFO, “$prefix INFO-level message $job”)