0

Get Customer Invoices from Quote email

Alexandros 10 months ago in Home Portal / Classic Projects updated by Dennis Rosenbaum 10 months ago 3

Hello again everyone,


We want to customize the "When quote is sent to client for approval" notification email (Classic Projects) so that it checks whether that customer has overdue invoices and their amount to add a custom text like (Please take care of the following overdue invoices).


The way we tried to go about it was:


#set($c = $utils.unwrap($quote).getCustomer())

#foreach($f in $c.getInvoices()))

#if ($f.isOverdue())

$overdue="TRUE"

//Print table with invoice information

#end

#end


However, we do not seem to be getting the set of customer invoices with $c.getInvoices(). I think it has something to do with the fact that the first line gives us a snapshot of the customer instead of the actual object, but maybe I am wrong. Does anyone have any clue how to approach this?

You are right. This is because the customer is a customerSnapshot.
You could reach the customer like this:

#set($customerService = $utils.getService("com.radzisz.xtrf.service.CustomerService"))
#set($c = $customerService.getById($quote.customer.id))

Thank you Dennis! Is that all documented somewhere or do you test and discover these?

Most of the things are documented, though not everything. After a while, you understand the minds of the XTRF software developers and then you can do some educated guesses.