PDF
Download PDF
Download page Custom Numbering Callback Class.
Custom Numbering Callback Class
You can stamp custom number on the invoices by adding a callback class for Invoice Numbering.
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 per your requirements.
In order to implement the interface, prefix it with Apttus_Billing.CustomClass.<Interface Name>
/**
* Apttus Billing
* DefaultCustomNumberingCallback
*
* @2011-2016 Apttus Inc. All rights reserved.
*/
public with sharing class DefaultCustomNumberingCallback
implements CustomClass.IFacilitateCustomTransactionNumbers {
/**
* Evaluate the "object type" of the specified numbering configuration settings and determine
* if the settings are valid for your custom implementation. For example, the default Apttus
* implementation of this interface for the "Invoice" object type expects that only "field 1" has
* been checked. This is critical because the user interface for the custom number entries
* uses the numbering configuration setting object to determine which fields to force the
* user to enter. Any field unchecked will be hidden from the user.
*
* @param customNumberingConfigSetting The custom number configuration setting to evaluate.
*
* @return true if the "custom numbering configuration settings" is valid for its underlying "object type",
* otherwise return false.
*/
public boolean isValidConfiguration(CustomNumberingConfigurationSetting__c numberingConfigSettings) {
if (numberingConfigSettings.ObjectType__c.equals(CustomClass.CUSTOM_NUMBERING_OBJECT_TYPE_INVOICE)) {
if (true == numberingConfigSettings.FieldOneEnabled__c &&
false == numberingConfigSettings.FieldtwoEnabled__c &&
false == numberingConfigSettings.FieldThreeEnabled__c &&
false == numberingConfigSettings.FieldFourEnabled__c &&
false == numberingConfigSettings.FieldFiveEnabled__c) {
return true;
}
}
return false;
}
/**
* Build the list of "lookup key" field lists for the each of the
* specified Invoices.
*
* @param invoices The list of Invoices to evaluate and to find the
* corresponding list of lookup key field lists for.
* @param customNumberingConfigSetting The custom number configuration
* setting for Invoices.
*
* @return the list of lists. Each element of the returned list must
* contain the "lookup key" field list for the corresponding Invoice.
* The number of lists returned must match the number of Invoices passed in
* and the ith list must correspond to the ith Invoice. For example, if
* 2 Invoices are passed in, then 2 "field lists" should be returned and
* the 1st field list must correspond to the 1st Invoice and the 2nd
* field list must correspond to the 2nd Invoice.
*/
public List<List<String>> fetchInvoiceCustomNumberingFieldLists(
List<Invoice__c> invoices,
CustomNumberingConfigurationSetting__c customNumberingConfigSetting)
{
List<List<String>> fieldLists = new List<List<String>>();
for (Invoice__c inv : invoices) {
List<String> fieldList = new List<String>();
fieldList.add(inv.BillingCountry__c);
fieldLists.add(fieldList);
}
return fieldLists;
}
}
CODE
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 Custom Invoice Numbering Callback Class.