Hi all,
Please I am getting this error message when I try to email using an email template. I have a template that is designed to send emails and attach reports with a pdf output.
The error is below:
Required report parameter “entity” not found
I know what is causing the error but I don’t know how to resolve it programmatically. There is not enough documentation on how to attach a report in an email template programmatically.
See my come below:
public void emailRFQ(QuotationRequest quoteReq) {
//set the tenant email smtp details
getMailPropertiesByTenant(quoteReq.getTenant());
String subject = messages.formatMessage(getClass(),"rfqCreation.subject",quoteReq.getRfqNo());
String orgName = tenantService.getTenant(quoteReq.getTenant()).getName();
try {
emailTemplates.buildFromTemplate(RFQ_CREATION_TEMPLATE_CODE)
.setFrom(tenantService.getTenant(quoteReq.getTenant()).getSenderEmail())
.setTo(quoteReq.getCustomer().getSalesPerson().getEmail())
.setSubject(subject)
.setBodyParameter("quotationRequest", quoteReq)
.setBodyParameter("bpCode", quoteReq.getCustomerCode())
.setBodyParameter("bpName", quoteReq.getCustomer().getBpName())
.setBodyParameter("salesperson", quoteReq.getCustomer().getSalesPerson().getName())
.setBodyParameter("orgName",orgName)
.sendEmailAsync();
}
catch (TemplateNotFoundException | ReportParameterTypeChangedException e) {
log.error("Error on notifying rfq creation: {}",e.getMessage());
}
}
See the screenshot of the email template and the attached report
I don’t know how to set the entity programmatically. The entity is the quoteReq parameter of the method but I don’t know how to set it programmatically in the email template
Thank you