Using Crystal Enterprise Notifications

In addition to being able to trigger alerts upon completion of a scheduled job, there are multiple notifications that can be set up. These are typically targeted for the consumption of Crystal Enterprise administrators as opposed to end users. There are two types of notifications: audit notification and e-mail notification.

There are two audit notifications that can be turned on: one for the success of a report job and one for the failure of a report job. When either of these audit notifications is enabled and a job finishes, a record is written to the auditing database indicating the job name, time, status, and so on. To enable audit notifications, call the getNotifications method of the ISchedulingInfo interface. This returns an INotifications interface. Using this interface, the setAuditOption method can be called, passing in a member of the CeAuditOnResult enumeration. The valid values are

  • CeAuditOnResult.NONE (no audit notification)
  • CeAuditOnResult.SUCCESS (audit notification enabled for a successful job)
  • CeAuditOnResult.FAILURE (audit notification enabled for a failed job)
  • CeAuditOnResult.BOTH (audit notification enabled for either success or failure of a job)

The following example schedules a report and enables audit notification for a successful job:






ISchedulingInfo sched = report.getSchedulingInfo();

sched.setRightNow(true);

INotifications notify = sched.getNotifications();

notify.setAuditOption(INotifications.CeAuditOnResult.SUCCESS);

iStore.schedule(results);


Email notification works in a similar manner. It can be enabled for both successful and failed jobs. To enable email notification, obtain the INotifications interface as described previously like you would do for auditing. From there, you can call the getDestinationsOnSuccess or getDestinationsOnFailure methods to obtain the IDestinations interface. You might recognize this interface as the same one used to configure schedule destinations. To enable email destinations using the Report Job Servers default email settings, you can simply call the IDestinationss add method passing in CrystalEnterprise.Smtp as shown here:






ISchedulingInfo sched = report.getSchedulingInfo();

sched.setRightNow(true);

INotifications notify = sched.getNotifications();

IDestinations dest = notify.getDestinationsOnSuccess();

dest.add("CrystalEnterprise.Smtp");

iStore.schedule(results);


If you want to customize the e-mail settings such as the recipients, subject line, and so on, you can call the getScheduleOptions method and get access to the ISMTPOptions interface.






Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net