Email Credit Memo Attachment Callback Class
This is a callback interface allows you to deliver credit memo emails along with attachments to a custom set of contacts. This interface allows the caller to deliver credit memo emails to contacts other than the ones specified at the Account or Account Location level.
To add the custom class
- Go to Setup > App Setup > Develop > Apex Classes.
- Click New.
- Enter the sample callback class code.
- Click Save.
This is just a sample callback class. You may change the code as per your requirements.
This sample callback interface comprises the following object:
EmailCreditMemoAttachmentInput |
||
---|---|---|
Field |
Type |
Description |
commaSeparatedEmailAddresses |
String |
Email Address of the Contact |
List<Contacts> |
List |
List of Contacts to send the Credit Memo Attachment |
CreditMemo__ccreditmemo |
Conga Object |
The credit memo to which the attachment is related |
creditMemoEmailTemplateId |
Id |
Idof the credit memo 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 credit memo attachment. By default, Conga Billing uses the contacts corresponding to the Account Location or the Account. If a credit memo 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 * Credit Memo attachment. This will allow each Credit Memo attachment * to be delivered to a custom set of "contacts" with a custom * Email Template Id. */ global class EmailCreditMemoAttachmentInput { // The Credit Memo the attachment pertains to. global CreditMemo__c creditMemo{ get; private set; } // The list of "contacts" to the send the Credit Memo 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 Credit Memo 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 creditMemoEmailTemplateId { 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 Credit Memo 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 Credit Memo attachments. * * @return The list of "delivery inputs" that was passed in and customized * accordingly. * * For a given Email Credit Memo Attachment Input object, Billing will "consume" * the object as follows. * * If (creditMemoEmailTemplateId != 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<EmailCreditMemoAttachmentInput> updateEmailAttachmentInputs( final List<EmailCreditMemoAttachmentInput> 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 Credit Memos */ public List<CustomClass.EmailCreditMemoAttachmentInput>updateEmailAttachmentInputs(List<CustomClass.EmailCreditMemoAttachmentInput>deliveryInputs){ for(CustomClass.EmailCreditMemoAttachmentInput emailInputObj : deliveryInputs){ //Customization for EmailInputs } return deliveryInputs; }
If you are using the Send Email button from the Credit Memo detail page, it is mandatory for the credit memo to have an attachment.
To add the name of custom callback class, go to Manage beside Billing Custom Classes. Click Edit for System Properties and enter the name of your custom callback class in Email Credit Memo Attachment Callback Class.
and click