Is there a way NOT to email if a report with no resultCron sending reports weeklyHow NOT to send email to “Activity Assignee” when assigned an activitymail_report format parameterciviCRM Cron only run one mail_report scheduled jobs?How to configure mail_report for every mailing?Can a Scheduled Job using mail_report send Reports as HTML in the e-mail body, rather than as a PDF attached to the e-mail?Send alert if smart group contains any contactsmail Fetch Bounces errorsSome members are not getting scheduled remindersHow to send email report FROM other than default email address?

How is CoreiX like Corei5, i7 is related to Haswell, Ivy Bridge?

Has there been evidence of any other gods?

Why did they go to Dragonstone?

Names of the Six Tastes

Company threw a surprise party for the CEO, 3 weeks later management says we have to pay for it, do I have to?

How to rename pi as another value only for y axis without affecting pi used in x axis?

How can a demonic viral infection spread throughout the body without being noticed?

Why is it wrong to *implement* myself a known, published, widely believed to be secure crypto algorithm?

Company stopped paying my salary. What are my options?

Is it a Munchausen Number?

Examine a folder named `-F/`

Is it a good idea to copy a trader when investing?

Why is PerfectForwardSecrecy considered OK, when it has same defects as salt-less password hashing?

date -d 'previous Monday" to display the preceding Monday

spatiotemporal regression

Hexagonal Grid Filling

How to get a ellipse shaped node in Tikz Network?

Why do unstable nuclei form?

Remove color cast in darktable?

Why use steam instead of just hot air?

Is there a need for better software for writers?

Was the Highlands Ranch shooting the 115th mass shooting in the US in 2019

Why does increasing the sampling rate make implementing an anti-aliasing filter easier?

What was the plan for an abort of the Enola Gay's mission to drop the atomic bomb?



Is there a way NOT to email if a report with no result


Cron sending reports weeklyHow NOT to send email to “Activity Assignee” when assigned an activitymail_report format parameterciviCRM Cron only run one mail_report scheduled jobs?How to configure mail_report for every mailing?Can a Scheduled Job using mail_report send Reports as HTML in the e-mail body, rather than as a PDF attached to the e-mail?Send alert if smart group contains any contactsmail Fetch Bounces errorsSome members are not getting scheduled remindersHow to send email report FROM other than default email address?













2















I need to email a report weekly to a department within organisation. Report usually sent via scheduled job in Pdf format.
If there's no result an email still gets sent. Is there way NOT to email an empty PDF? thanks










share|improve this question


























    2















    I need to email a report weekly to a department within organisation. Report usually sent via scheduled job in Pdf format.
    If there's no result an email still gets sent. Is there way NOT to email an empty PDF? thanks










    share|improve this question
























      2












      2








      2








      I need to email a report weekly to a department within organisation. Report usually sent via scheduled job in Pdf format.
      If there's no result an email still gets sent. Is there way NOT to email an empty PDF? thanks










      share|improve this question














      I need to email a report weekly to a department within organisation. Report usually sent via scheduled job in Pdf format.
      If there's no result an email still gets sent. Is there way NOT to email an empty PDF? thanks







      email civireport pdf scheduled-job






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      TapashTapash

      1,086511




      1,086511




















          2 Answers
          2






          active

          oldest

          votes


















          2














          As suggested by Demerit you can use alterMailParams to abort the email if the report has 0 rows. It will work on simple use case but would be difficult or need to add more logic you passing any additional parameters when running cron job or through url to filter the result since the ReportTemplate.getrows api will return the results which is saved in the database but not on fly.



          However you can using hook_civicrm_alterReportVar and set $this->_sendmail to FALSE when $rows are empty.



          HTH



          Pradeep






          share|improve this answer























          • Thanks @pradeep

            – Tapash
            4 hours ago











          • Oh cool. Never knew about that.

            – Demerit
            3 hours ago


















          1














          If it were CSV you could use hook_civicrm_alterMailParams and just check the attachment and if it has 0 rows then set $params['abortMailSend'] = TRUE; to stop it sending.



          For PDF I guess you could do the same thing, but do an api call to ReportTemplate.getrows (see api/v3/examples/ReportTemplate/Getrows.php, or the api explorer at /civicrm/api) and if it has 0 rows then abort as above.






          share|improve this answer























          • Thanks! @Demerit

            – Tapash
            4 hours ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "605"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcivicrm.stackexchange.com%2fquestions%2f30576%2fis-there-a-way-not-to-email-if-a-report-with-no-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          As suggested by Demerit you can use alterMailParams to abort the email if the report has 0 rows. It will work on simple use case but would be difficult or need to add more logic you passing any additional parameters when running cron job or through url to filter the result since the ReportTemplate.getrows api will return the results which is saved in the database but not on fly.



          However you can using hook_civicrm_alterReportVar and set $this->_sendmail to FALSE when $rows are empty.



          HTH



          Pradeep






          share|improve this answer























          • Thanks @pradeep

            – Tapash
            4 hours ago











          • Oh cool. Never knew about that.

            – Demerit
            3 hours ago















          2














          As suggested by Demerit you can use alterMailParams to abort the email if the report has 0 rows. It will work on simple use case but would be difficult or need to add more logic you passing any additional parameters when running cron job or through url to filter the result since the ReportTemplate.getrows api will return the results which is saved in the database but not on fly.



          However you can using hook_civicrm_alterReportVar and set $this->_sendmail to FALSE when $rows are empty.



          HTH



          Pradeep






          share|improve this answer























          • Thanks @pradeep

            – Tapash
            4 hours ago











          • Oh cool. Never knew about that.

            – Demerit
            3 hours ago













          2












          2








          2







          As suggested by Demerit you can use alterMailParams to abort the email if the report has 0 rows. It will work on simple use case but would be difficult or need to add more logic you passing any additional parameters when running cron job or through url to filter the result since the ReportTemplate.getrows api will return the results which is saved in the database but not on fly.



          However you can using hook_civicrm_alterReportVar and set $this->_sendmail to FALSE when $rows are empty.



          HTH



          Pradeep






          share|improve this answer













          As suggested by Demerit you can use alterMailParams to abort the email if the report has 0 rows. It will work on simple use case but would be difficult or need to add more logic you passing any additional parameters when running cron job or through url to filter the result since the ReportTemplate.getrows api will return the results which is saved in the database but not on fly.



          However you can using hook_civicrm_alterReportVar and set $this->_sendmail to FALSE when $rows are empty.



          HTH



          Pradeep







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 5 hours ago









          Pradeep NayakPradeep Nayak

          12.6k1624




          12.6k1624












          • Thanks @pradeep

            – Tapash
            4 hours ago











          • Oh cool. Never knew about that.

            – Demerit
            3 hours ago

















          • Thanks @pradeep

            – Tapash
            4 hours ago











          • Oh cool. Never knew about that.

            – Demerit
            3 hours ago
















          Thanks @pradeep

          – Tapash
          4 hours ago





          Thanks @pradeep

          – Tapash
          4 hours ago













          Oh cool. Never knew about that.

          – Demerit
          3 hours ago





          Oh cool. Never knew about that.

          – Demerit
          3 hours ago











          1














          If it were CSV you could use hook_civicrm_alterMailParams and just check the attachment and if it has 0 rows then set $params['abortMailSend'] = TRUE; to stop it sending.



          For PDF I guess you could do the same thing, but do an api call to ReportTemplate.getrows (see api/v3/examples/ReportTemplate/Getrows.php, or the api explorer at /civicrm/api) and if it has 0 rows then abort as above.






          share|improve this answer























          • Thanks! @Demerit

            – Tapash
            4 hours ago















          1














          If it were CSV you could use hook_civicrm_alterMailParams and just check the attachment and if it has 0 rows then set $params['abortMailSend'] = TRUE; to stop it sending.



          For PDF I guess you could do the same thing, but do an api call to ReportTemplate.getrows (see api/v3/examples/ReportTemplate/Getrows.php, or the api explorer at /civicrm/api) and if it has 0 rows then abort as above.






          share|improve this answer























          • Thanks! @Demerit

            – Tapash
            4 hours ago













          1












          1








          1







          If it were CSV you could use hook_civicrm_alterMailParams and just check the attachment and if it has 0 rows then set $params['abortMailSend'] = TRUE; to stop it sending.



          For PDF I guess you could do the same thing, but do an api call to ReportTemplate.getrows (see api/v3/examples/ReportTemplate/Getrows.php, or the api explorer at /civicrm/api) and if it has 0 rows then abort as above.






          share|improve this answer













          If it were CSV you could use hook_civicrm_alterMailParams and just check the attachment and if it has 0 rows then set $params['abortMailSend'] = TRUE; to stop it sending.



          For PDF I guess you could do the same thing, but do an api call to ReportTemplate.getrows (see api/v3/examples/ReportTemplate/Getrows.php, or the api explorer at /civicrm/api) and if it has 0 rows then abort as above.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 5 hours ago









          DemeritDemerit

          4,5812622




          4,5812622












          • Thanks! @Demerit

            – Tapash
            4 hours ago

















          • Thanks! @Demerit

            – Tapash
            4 hours ago
















          Thanks! @Demerit

          – Tapash
          4 hours ago





          Thanks! @Demerit

          – Tapash
          4 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to CiviCRM Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcivicrm.stackexchange.com%2fquestions%2f30576%2fis-there-a-way-not-to-email-if-a-report-with-no-result%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Siegen Nawigatsjuun

          Log på Navigationsmenu

          Log på Navigationsmenu