You can split a billing schedule by calling an API. There are three different APIs to support the Split by Amount, Split by Percentage, or Split by Date functionalities.

API Response

Split by Amount

// Set Billing Schedule input parameters for Split Billing Schedule
List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper> SplitLineWrapperInputs = new List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper>();
List<Apttus_Billing.BillingScheduleSplitWrapper> SplitWrapperInputs = new List<Apttus_Billing.BillingScheduleSplitWrapper>();

 

Id billingScheduleId1 = 'Billing Schedule Id here';

 

SplitLineWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 2), 30.0));
SplitLineWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 15), 40.0));

 

SplitWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper(
    billingScheduleId1, //billingschedule id
    null, //asset id null as of now
    Apttus_Billing.BillingScheduleSplitWrapper.SplitMethod.SPLIT_BY_AMOUNT, //split method
    2, //no of splits
    SplitLineWrapperInputs // date parameters 
));

 

List<Apttus_Billing.BillingScheduleSplitWrapper> actualSplitResults = Apttus_Billing.BillingService.createSplitBilling(SplitWrapperInputs);
System.debug('actualSplitResults========================' + actualSplitResults);
CODE



When you call this API, it will split the billing schedule by Amount. 

The total of the split amount must be less than or equal to the fee amount of the billing schedule you want to split.

Split by Percentage

// Set Billing Schedule input parameters for Split Billing Schedule
List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper> SplitLineWrapperInputs = new List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper>();
List<Apttus_Billing.BillingScheduleSplitWrapper> SplitWrapperInputs = new List<Apttus_Billing.BillingScheduleSplitWrapper>();

 

Id billingScheduleId1 = 'Billing Schedule Id here';

 

SplitLineWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 2), 30.0));
SplitLineWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 15), 40.0));

 

SplitWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper(
    billingScheduleId1, //billingschedule id
    null, //asset id null as of now
    Apttus_Billing.BillingScheduleSplitWrapper.SplitMethod.SPLIT_BY_PERCENTAGE, //split method
    2, //no of splits
    SplitLineWrapperInputs // date parameters 
));

 

List<Apttus_Billing.BillingScheduleSplitWrapper> actualSplitResults = Apttus_Billing.BillingService.createSplitBilling(SplitWrapperInputs);
System.debug('actualSplitResults========================' + actualSplitResults);
CODE
When you call this API, it will split the billing schedule by percentage. 

The split percentage total must not be more than 100.

Split by Date

// Set Billing Schedule input parameters for Split Billing Schedule
List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper> SplitLineWrapperInputs1 = new List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper>();
List<Apttus_Billing.BillingScheduleSplitWrapper> SplitWrapperInputs = new List<Apttus_Billing.BillingScheduleSplitWrapper>();

Id billingScheduleId1 = 'Billing Schedule ID';
Id assetId1 = 'Asset ID';
SplitLineWrapperInputs1.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 2), 3.0)); //Date formate (YYYY,MM,DD), Amount 4.0 OR Percentage 33.333 OR null(when its SPLIT_BY_DATE)
SplitLineWrapperInputs1.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 1, 15), 4.0)); //Date formate (YYYY,MM,DD), Amount 4.0 OR Percentage 33.333 OR null(when its SPLIT_BY_DATE)

SplitWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper(
    billingScheduleId1,  //Billing Schedule ID
    assetId1,  //Asset ID
    Apttus_Billing.BillingScheduleSplitWrapper.SplitMethod.SPLIT_BY_AMOUNT, //SPLIT_BY_AMOUNT,SPLIT_BY_PERCENTAGE,SPLIT_BY_DATE
    2, //Number of Split
    SplitLineWrapperInputs1 //inputs for SplitLineItems
));

List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper> SplitLineWrapperInputs2 = new List<Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper>();

Id billingScheduleId2 = 'Billing Schedule ID';
Id assetId2 = 'Asset ID';
SplitLineWrapperInputs2.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 2, 2), 5.0)); //Date formate (YYYY,MM,DD), Amount 4.0 OR Percentage 33.333 OR null(when its SPLIT_BY_DATE)
SplitLineWrapperInputs2.add(new Apttus_Billing.BillingScheduleSplitWrapper.BillingScheduleSplitLineWrapper(Date.newInstance(2023, 2, 15), 6.0)); //Date formate (YYYY,MM,DD), Amount 4.0 OR Percentage 33.333 OR null(when its SPLIT_BY_DATE)

SplitWrapperInputs.add(new Apttus_Billing.BillingScheduleSplitWrapper(
    billingScheduleId2, //Billing Schedule ID
    assetId2, //Asset ID
    Apttus_Billing.BillingScheduleSplitWrapper.SplitMethod.SPLIT_BY_AMOUNT, //SPLIT_BY_AMOUNT,SPLIT_BY_PERCENTAGE,SPLIT_BY_DATE
    2, //Number of Split
    SplitLineWrapperInputs2 //inputs for SplitLineItems
));

List<Apttus_Billing.BillingScheduleSplitWrapper> actualSplitResults = Apttus_Billing.BillingService.createSplitBilling(SplitWrapperInputs);
System.debug('actualSplitResults========================' + actualSplitResults);
CODE

When you call this API, it will split the billing schedule by Date. 

Enter the split date for all split line items. When you set the date as the first parameter then the second parameter should be null.