This callback interface allows you to deliver Invoice emails along with attachments to a custom set of contacts. This interface allows the caller to deliver Invoice emails to contacts other than the ones specified at the Account or Account Location level. 

To add the custom class

  1. Go to Setup > App Setup > Develop > Apex Classes.

  2. Click New.

  3. Enter the sample callback class code.

  4. Click Save.

This is just a sample callback class. You may change the code per your requirements.

This sample callback interface comprises the following object:

commaSeparatedEmailAddressesStringEmail Address of the Contact
List<Contacts>ListList of Contacts to send the Invoice Attachment
Invoice__c invoiceApttus ObjectThe invoice to which the attachment is related
invoiceEmailTemplateIdIdIdof the invoice Email Template to apply

In order to implement the interface, prefix it with Apttus_Billing.CustomClass.<Interface Name> 

The sample callback class enables the caller to customize the email delivery for a given invoice attachment. By default, Apttus Billing Management uses the contacts corresponding to the Account Location or the Account. If an Invoice has an Account Location, which has Invoice Separately? selected, the contracts are retrieved from the Account Location. Else, contacts are retrieved from the Account.
With this interface, you can override the contacts retrieved from the Account Location or Account.

Only the latest created attachment is sent in the email.

 * Information used to customize the email delivery for a given
 * Invoice attachment.  This will allow each Invoice attachment
 * to be delivered to a custom set of "contacts" with a custom
 * Email Template Id.
global class EmailInvoiceAttachmentInput
	// The Invoice the Invoice attachment pertains to.
	global Invoice__c invoice { get; private set; }

	// The list of "contacts" to the send the Invoice attachment to. By default Billing
	// will try to get the contacts that correspond to affiliate Account Location.  If an
	// Account Location does not exist or it is not applicable, Billing will fetch the
	// "contacts" of the Bill-to Account.
	// If relevant, overwrite this list with a list of "contacts" based on
	// custom business logic (like retrieve Contacts from corresponding Proposal).
	global List<Contact> contacts { get; set; }

	// The optional list of comma separated Email Addresses.
	// If relevant, overwrite this list with a list of comma separated Email Addresses
	// based on  custom business logic.
 	global String commaSeparatedEmailAddresses;

	// The Id of the Invoice Email Template to apply. By default Billing will	
	// try to use the Invoice Email Template of the affiliate Account Location.
	// If the Account Location does not exist or is not applicable, Billing will get
	// the Invoice Email template Id of the affiliate Bill-To Account.
	// If relevant, overwrite this Id with the Template Id according to the custom
	// business logic.
	global ID invoiceEmailTemplateId { get; set; }
	global string defaultEmailBody {get; set; }

/** Implement this interface in order to customize the list of contacts and template Id 
  * to "apply" when emailing attachments for Invoices and Credit Memos.
global interface IUpdateEmailAttachmentInputs
	 * Evaluate the list of Email Invoice Attachment objects and modify
	 * (in place) if the list of "contacts" and/or the Email Template Id
	 * need to be altered for a given Invoice.
	 * If the list of "Contacts" is emptied or set to "null" for a given Invoice
	 * then no Email (and attachment) will be sent for that Invoice. 
	 * @param deliveryInputs The list of "inputs" used to customize Email
	 *  delivery for a set Invoice attachments.
	 * @return The list of "delivery inputs" that was passed in and customized
	 *  accordingly.
	 * For a given Email Invoice Attachment Input object, Billing will "consume"
	 * the object as follows.
	 * If (invoiceEmailTemplateId  != null) Then
	 * 	 Use Contact list in conjunction with the Email Template
	 * Else
	 * If (Comma Separated List of Email Addresses IS NOT Null or Empty)
	 * 	 Use Comma Separated List of Email Addresses with default Email body
	 * Else If (Contact List IS NOT Null or Empty)
	 * 	Get Email Addresses from Contact List and use with default Email body 
	List<EmailInvoiceAttachmentInput> updateEmailAttachmentInputs( 
		final List<EmailInvoiceAttachmentInput> deliveryInputs);
public class TestEmailAttachmentInputCallback implements Apttus_Billing.CustomClass.IUpdateEmailAttachmentInputs
 	* Implement interface method to set
    * different attributes of email delivery inputs to verify different scenarios
    * for Invoice
    public List<CustomClass.EmailInvoiceAttachmentInput>updateEmailAttachmentInputs(List<CustomClass.EmailInvoiceAttachmentInput>deliveryInputs){
       for(CustomClass.EmailInvoiceAttachmentInput emailInputObj : deliveryInputs){
           //Customization for EmailInputs

	return deliveryInputs;



If you are using the Send Invoice Email button from the Invoice Detail page, it is mandatory for the invoice to have an attachment. 

To add the name of custom callback class, go to Setup > App Setup > Develop > Custom Settings and click Manage beside Billing Custom Classes. Click Edit for System Properties and enter the name of your custom callback class in Email Invoice Attachment Callback Class.