Generate and Send Printable by Email started by timer
Hi Community
When trying to generate a printable and save as an attachment
following the approach on this article:
https://community.creatio.com/articles/generate-printable-and-send-it-a…
Everything works fine if it is triggerer manually.
When the trigger is based on a timer I get the following error:
"
System.ServiceModel.ServiceActivationException: Set AspNetCompatibilityEnabled true
at Terrasoft.Web.Common.BaseService.get_UserConnection()
at Terrasoft.Configuration.ReportService.ReportService.GenerateMSWordReport(String urlTemplateId, String urlRecordUId, Boolean convertInPDF)
at Terrasoft.Core.Process.Configuration.imdCriarRelatorioGravarAnexoRelatorios.InternalExecute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessActivity.ExecuteElement(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessActivity.Execute(ProcessExecutingContext context)
"
Any ideas on how to resolve this issue?
Thanks,
Luis
Like
Hi!
The problem is that the ReportService requires HttpContext. Make sure that the start signal is not set to background mode since HttpContext cannot be used in background mode.
Best regards,
Angela
Hi Angela,
Thanks for quick reply, it seems to be that, since I can replicate the error If I pass the manual trigger to background
My problem is that I can't find the background boolean for the start timer trigger. Am I missing something?
Thanks again,
Luis
Luis Tinoco Azevedo,
The issue is happening because in OOB timer element is started in the background by default. Try to pass parameter UserConnection
to ReportService:
var reportService = new Terrasoft.Configuration.ReportService.ReportService(UserConnection);