4

I'd like to get users more in tune with their data by sending them notifications of certain high-value reports. I really don't want them with the data attached in a PDF or worse, a CSV. I'd rather just have the report link by itself (it already does this).

How can I remove the attachment option altogether?

Perhaps more importantly, how can I modify the email template so I can add some message content directly into the report email itself (not in the PDF attachment). What template is this using? I'd just want to hard-code some text that would apply to all reports.

2

The email body content starts here for csv: https://github.com/civicrm/civicrm-core/blob/5.18.4/CRM/Report/Form.php#L3413, and a bit lower down for pdf.

Note also the attachments are hardcoded in, a couple lines lower down.

Note that in the report itself on the Title and Format tab you can add some text/html at the end of the header which will get included in the email.

The code seems to be after hook_civicrm_alterReportVar so I don't think you can use that to remove the attachments, but you should be able to use hook_civicrm_alterMailParams to remove the attachments.

1

I'd probably just make a separate cron script that emails them the links and whatever text you want, i.e. not using the scheduled report task just a plain cron script. If you want to send to a civi group or something like that then the cron script could be a cv script and then use the civi api inside the script.

  • I need to stick to the civireport email functionality + scheduled job. I have a simple use case and just need to find the template to add text. – Andy Burns Oct 25 '19 at 22:36
  • Ok, have added another answer. – Demerit Oct 25 '19 at 23:09
1

We use the 'Title and Format' tab as Demerit mentions above and have stuck some text/html in the 'Report Header' box. To avoid attachments going out with them went with the below parameters for the scheduled job. instanceId=x format=print Not a global solution but may be suitable if results aren't too large.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.