The following Apex method can be used to create a capped fee matter fee arrangement for a matter via custom coding. Please be aware that you are always advised to test your code in the sandbox.
Syntax:
FeeArrangementService.createCappedFeeMatterFeeArrangement(
@feeArrangementRecordId,
@matterRecordId,
@matterPrice,
@includeExpenses,
@defaultForFees,
@defaultForExpenses,
@recurrence,
@startDate,
@endDate
);
Parameters:
@feeArrangementRecordId
The fee arrangement record's id value using which the fixed fee type of matter fee arrangement is to be created.
@matterRecordId
The matter record's id value for which the fixed fee type of matter fee arrangement is to be created.
@matterPrice
Your finalized matter price was offered to the client.
@includeExpenses
To mark this matter fee arrangement as the default when entering time for this matter.
@defaultForFees
To mark this matter fee arrangement as the default when entering time for this matter.
@defaultForExpenses
To mark this matter fee arrangement as the default when entering expenses for this matter.
@recurrence
Provide how often the client will be charged for these fees.
(Accepted values are: One Time
, Monthly
, Quarterly
, Annually
)
@startDate
If your recurrence is other than One Time, then provide the start date for it.
@endDate
If your recurrence is other than One Time, then provide the end date for it.
Result:
The function will return a list of sObjects for the matter fee arrangement type.
- RecordTypeId
- RecordType.DeveloperName
- Name
- advpm__Type__c
- advpm__Description__c
- advpm__Source_Fee_Arrangement__c
- advpm__Matter__c
- advpm__Matter_Price__c
- advpm__Discount_Percentage__c
- advpm__Contingency_Percentage__c
- advpm__Fee_Arrangement_Price__c
- advpm__Total_Unit_Caps__c
- advpm__Recurrence__c
- advpm__Default_for_Fees__c
- advpm__Default_for_Expenses__c
- advpm__Start_Date__c
- advpm__End_Date__c
- advpm__Transactions_Billed_To_Date__c
- advpm__Transactions_To_Be_Billed__c
- advpm__Total_Price__c
- advpm__Total_Cost_as_Priced__c
- advpm__As_Priced_Profit_Margin__c
- advpm__Total_Cost_for_Expenses__c
- advpm__Total_Cost_for_Time__c
- advpm__Total_Cost_as_Delivered__c
- advpm__As_Delivered_Profit_Margin__c
- advpm__NextBillDate__c
- advpm__LastBillDate__c
- CreatedDate
- LastModifiedDate
- CreatedById
- LastModifiedById
- OwnerId
Example:
advpm__Matter_Fee_Arrangement__c result = FeeArrangementService.createCappedFeeMatterFeeArrangement(
'a0A9000000RJhKTE',
'a05900000051CpN',
2000,
true,
true,
false,
'Monthly',
Date.valueOf('2023-01-01'),
Date.valueOf('2023-10-31')
);
System.debug('Matter Fee Arrangement created : ' + result.Name);