Announcement

Migration of this forum

Dear users of this forum,

we are pleased to inform you that we will be updating the software behind this forum in the near future.

Existing posts, users and categories will remain untouched.

Important:

  • Each user will need to reset their password.
  • Please select "I forgot my password".
  • Enter the email address you used to register in this forum.
  • You will receive an email with a link to set a new password.
  • Please choose a new (secure) password and confirm the process.

We will keep you informed in the pinned thread.

Kind regards,
Your ReportServer Team


Migration des Forums

Liebe Nutzer dieses Forums,

wir freuen uns, euch mitteilen zu können, dass wir in naher Zukunft die Software hinter diesem Forum aktualisieren werden.

Existierende Beiträge, Nutzer und Kategorien bleiben weiterhin bestehen!

Wichtig:

  • Jeder Nutzer muss sein Passwort neu vergeben.
  • Wählt dazu einfach "Ich habe mein Passwort vergessen".
  • Gebt die E-Mail-Adresse ein, mit der ihr registriert seid.
  • Ihr erhaltet eine E-Mail mit einem Link zur Passwortvergabe.
  • Bitte wählt ein neues (sicheres) Passwort und bestätigt den Vorgang.

Wir halten euch im angepinnten Beitrag auf dem Laufenden!

Mit vielen Grüßen
Euer ReportServer Team

#1 2017-10-23 14:46:04

eike.welk
Member
Registered: 2017-10-12

Send Report to Group of Users

Is it possible to send a scheduled report to a group of users?

I can organize users in groups and organization units. However when I want to schedule reports, I can only select individual users as recipients of the report.

I would like to select a group or organization unit as the recipient of a report. A new user would then be added to a certain group, and would then receive all reports that are sent to this group. Currently I have to go through every report, that the new user should get, and have to add him separately to each report.

Is this somehow possible?


Regards
Eike.

Offline

#2 2017-10-23 15:05:31

jalbrecht
Administrator
Registered: 2016-10-21

Re: Send Report to Group of Users

Hi Eike,

to send a set of reports to a group of users will be one of our next attempts (Features for 3.1). Nevertheless unfortunatly neither is possible in the actual version.

wbr jan

Offline

#3 2017-10-24 07:07:47

IF_Eduardo
Administrator
Registered: 2016-11-01
Website

Re: Send Report to Group of Users

Hi Eike,

I created ticket RS-2787 for this (will be probably available for 3.1).
In the meanwhile, if you are using EE, you can write a script as described here: https://reportserver.net/en/guides/scri … s/Send-To/
This creates a new "send to" button, which can also be used for scheduling. There was a bug with 3.0.2, so please use 3.0.3 (beta) for this.

An example (again, use this, since there is a bug with the example online):

import net.datenwerke.rs.core.service.sendto.hooks.SendToTargetProviderHook
import net.datenwerke.rs.core.service.sendto.hooks.adapter.SendToTargetProviderHookAdapter
import net.datenwerke.rs.core.client.sendto.SendToClientConfig

import net.datenwerke.rs.core.service.mail.MailService
import net.datenwerke.rs.core.service.reportmanager.ReportService
import net.datenwerke.rs.core.service.reportmanager.ReportExecutorService
import net.datenwerke.rs.core.service.mail.SimpleAttachement

import java.util.HashMap

def HOOK_NAME = "MY_SEND_TO"

reportService = GLOBALS.getInstance(ReportService.class)
reportExec = GLOBALS.getInstance(ReportExecutorService.class)
mailService = GLOBALS.getInstance(MailService.class)


String doSendMail(report, values, execConfig) {
  
   def pdf = null;
   if (execConfig != null) pdf = reportExec.execute(report, "PDF", execConfig)
  	else pdf = reportExec.execute(report, "PDF");

        // prepare for sending mail
        def mail = mailService.newSimpleMail()
        mail.setSubject("The Report")

// you can read all members of a given group and set them as recipient by: 
        mail.setToRecipients("email1@domain.com", "email2@domain.com")

        mail.setFrom("mail@mail.com")
        def attachement = new SimpleAttachement(pdf.getReport(), pdf.getMimeType(), "filename.pdf")
        mail.setContent("Some Message", attachement)

        // send mail
        mailService.sendMail(mail)

   	return "Send the report via mail. Config " + values
}


def callback = [
  consumes : { report ->
    def config = new SendToClientConfig();
    config.setTitle("Send via Custom Mail");
    return config;
  },
  getId : { ->
    return "someUniqueId"
  },
  sendTo : { report, values, execConfig ->
  	return this.doSendMail(report, values, execConfig);
  },
  
  scheduledSendTo: { compiledReport, report,
			format, values,
			execConfig ->
	return this.doSendMail(report, values, execConfig);
  }

] as SendToTargetProviderHookAdapter

GLOBALS.services.callbackRegistry.forceRegisterHook(HOOK_NAME, SendToTargetProviderHook.class, callback)
GLOBALS.services.callbackRegistry.attachHook(HOOK_NAME, SendToTargetProviderHook.class, callback)

Regards,
Eduardo

Offline

#4 2017-10-24 09:15:44

eike.welk
Member
Registered: 2017-10-12

Re: Send Report to Group of Users

Thank you very much for your fast and informative replies.

Eike.

Offline

Board footer

Powered by FluxBB