Home General

Problem with Groups.OnGetEmailSettings from within the report designer/RAP

Hi,

When I try and use the Groups.OnGetEmailSettings from within the report (designer/rap) to set the Recipients, Subject, and Body it does not seem to work properly. The Recipients get set properly but the Subject and Body do not get set. In fact, the Subject gets set to the filename of the PDF that is created. If I do the exact same thing in code using the OnGetEmailSettings event, the Recipients, Subject and Body get set correctly. I know they should both work the same regardless of where I code it, but I cannot get it to work form within the report (designer/rap). I have been able to recreate the issues in the EmailGroupDemo. If you could look into the issue that would be greatly appreciated.
Thanks,
Scott

Comments

  • edited June 2018
    Hi Scott,

    I tried this but was unable to recreate the issue using the EmailGroupDemo and the latest version of ReportBuilder. Below is my RAP code and the resulting EmailSettings are correct when passed to the file device.
    procedure Group1OnGetEmailSettings(EmailSettings: TObject);
    var
    lEmailSettings: TppEmailSettings;
    begin

    lEmailSettings := TppEmailSettings(EmailSettings);

    lEmailSettings.Subject := 'My Subject';
    lEmailSettings.Body.Add('My Email Body');

    end;
    Let me know how I can alter this to see the issue you are getting and I'll research a solution asap.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,

    Strange... The following does not work properly...
    procedure Group1OnGetEmailSettings(EmailSettings: TObject);
    begin
    
      TppEmailSettings(EmailSettings).Recipients.Clear;
      TppEmailSettings(EmailSettings).Recipients.Add('somebody@somedomain.com');
      TppEmailSettings(EmailSettings).Subject := 'Invoice: ' + DBPipeline1['CustNo'];
      TppEmailSettings(EmailSettings).Body.Text := 'Pay up!!';
    
    end;
    But, the following does work properly...
    procedure Group1OnGetEmailSettings(EmailSettings: TObject);
    var
      lEmailSettings: TppEmailSettings;
    begin
    
      lEmailSettings := TppEmailSettings(EmailSettings); 
    
      lEmailSettings.Recipients.Clear;
      lEmailSettings.Recipients.Add('somebody@somedomain.com');
      lEmailSettings.Subject := 'Invoice: ' + DBPipeline1['CustNo'];
      lEmailSettings.Body.Text := 'Pay up!!';
    
    end;

    At least I'm able to get it to work now. Thanks for your help.
    Thanks,
    Scott
Sign In or Register to comment.