Prerequisites
Prior to reading this article, we recommend that you become familiar with the Salesforce Flow by completing the Flow Builder module in Salesforce Trailhead.
Note: If you have already completed this module, continue with reading this article.
Overview
Amortizing revenue and expenses has never been easier with the new declarative features built into the Accounting Seed Financial Suite. You can now declaratively leverage the same Amortization options that are accessible via our standard Amortization component using the Salesforce Flow. A custom flow action is now available to add to any user defined flows to perform Amortization for selected source document records (currently available for Billings and Payables).
Do you want to:
Amortization Flow Considerations
Amortization Methods
Amortization methods available via the standard Accounting Seed component or declaratively via Flow are stored as records of the Custom Metadata Type, AcctSeed__Bindings__mdt. The standard methods available are Daily Amortization and Monthly Amortization. These methods can be overridden and/or new Apex amortization methods can be created to meet your specific needs. To view these options navigate to Setup > Custom Metadata Types > Bindings > Manage Bindings.
Note: Click here to view the above image in full screen.
Default Debit and Credit GL Accounts
In order to insert Amortization records, General Ledger Debit and Credit Accounts need to be defined, which will be applied to the records created. Default Accounts are configured in Accounting Settings (AcctSeed__Default_Credit_GL_Account_Expense__c, AcctSeed__Default_Credit_GL_Account_Revenue__c, AcctSeed__Default_Debit_GL_Account_Expense__c, AcctSeed__Default_Debit_GL_Account_Revenue__c).
These defaults are used in the following example.
Amortization Flow Example | |
The Accounting Seed custom flow action (Apex action) can be utilized on Auto-Launched, Schedule-Triggered, and Record-Triggered flows. The entry point into the Flow can be customized to meet your business needs. In the Auto-Launched Flow example shown, a Get Records Flow component is being used to query Billing records to perform Amortization on. The following steps of this Flow example will be described in detail.
|
![]() |
Return to top
Create an Amortization Flow
To create a new Flow, navigate to Setup > Flows and click New Flow. Select your Flow of choice and select Next. Your new Flow is now created and we can begin to add actions.
Note: The example is utilizing an Auto-Launched Flow. The same Flow logic can be created on a Record-Triggered or Schedule-Triggered Flow.
- Get Records to Amortize.
- Select the + icon to add an element, and then select Get Records.
- From the Get Records screen, define the logic to query the records that you want to Amortize. In this example, specific Billing records are being selected to Amortize. Notice that the example has no filter criteria. Therefore, it will Amortize all Billings.
Important: Be sure to define filter criteria in order for the Flow to work on specific records. - Click Done.
- Select the + icon to add an element, and then select Get Records.
- Get Amortization Methods defined in Custom Metadata.
- Select the + icon to add an element, and then select Get Records.
- From the Get Records screen, select the Binding custom metadata object and filter to records with AcctSeed__Type__c = AbstractAmortization AND MasterLabel = Monthly. You can select any Amortization that exists in AcctSeed__Bindings__mdt records.
For this example, Monthly Amortization was selected. - Click Done.
- Select the + icon to add an element, and then select Get Records.
- Get GL Account Defaults defined in Accounting Settings.
- Select the + icon to add an element, and then select Get Records.
- From the Get Records screen, select the Accounting Settings custom object and select the option to store only the first record.
- Store the results as a Record Variable and be sure to add the fields as seen in the screen captures below.
Note: This step is selecting the default GL Expense and Revenue Accounts from Accounting Settings. If you choose not to use the defaults, you can select any applicable GL Account using a Get Records element and skip this step. - Click Done.
- Select the + icon to add an element, and then select Get Records.
- Loop over records to Amortize.
- Select the + icon to add an element, and then select Loop.
- On the New Loop screen for the Collection Variable, set it to the results of step 3, Get_Records_To_Amortize and leave the default direction.
- Click Done.
- Select the + icon to add an element, and then select Loop.
- Utilize Accounting Seed custom Flow Action component to calculate Amortization schedule.
- Select the + icon to add an element, and then select Action.
- From the left pane, filter by Uncategorized. Then, search for and select Amortize Records.
- Click Done.
- Enter a Label (i.e. Create Amortization Records).
Note: The API Name is automatically generated. - Enter the corresponding input variable values (refer to the screen capture below). Required fields display with a red asterisk (*) and include the following:
- Amortization Method
- End Date
- Record To Amortize Id
- Start Date
- Click Done.
Return to top
Notes:
The Amortize Records action does not insert the records. It creates them for insertion in a subsequent Flow action, which allows for any type of pre-insertion processing that you might choose.
The Credit and Debit GL Account Inputs are not required to create the Amortization Entry records but they are required for insertion into the database in a subsequent step.
The AcctSeed__Amortization.cls Apex class contains an @InvocableMethod, which enables our Amortization code to be called declaratively via a Salesforce Flow action. This method has defined input variables, which is what is seen on the Amortize Records action screen.
- Select the + icon to add an element, and then select Action.
- Add Amortization (Scheduled Revenue/Expense) records to collection.
- Create a Flow variable to store all Amortization Entries for insertion.
- From the Flow Toolbox, click New Resource.
- Enter Variable for Resource Type.
- Enter an API Name (i.e. AmortizationRecordsToInsert).
- From the Data Type drop-down list, select Record and select the Allow Multiple checkbox.
- In the Object field, enter Amortization Entry.
- Click Done.
- Assign the output from the Accounting Seed custom flow action (step 5) to the newly created variable.
- Select the + icon to add an element, and then select Assignment.
- Enter a Label (i.e. Collect Amortization Records).
Note: The API Name is automatically generated. - Set the Variable to the previously created Flow variable: AmortizationRecordsToInsert.
- From the Operator drop-down list, select Add.
- Select the Outputs from the Accounting Seed custom flow action (step 5) Create_Amortization_Records.amortizationEntries.
- Select the + icon to add an element, and then select Assignment.
- Click Done.
- Create a Flow variable to store all Amortization Entries for insertion.
- Insert Amortization records.
- Select the + icon to add an element, then select Create Records.
- Enter a Label (i.e. Insert Amortization Records).
Note: The API Name is automatically generated. - Click the Multiple radio button.
- Set the Record Collection to the variable created in the previous step: AmortizationRecordsToInsert.
- Click Done.
- Select the + icon to add an element, then select Create Records.
The Flow is now ready for Debugging, Running, and Activation.
Important: When running Flows, be extremely careful because they will impact data in the org (organization) that you are using. If you are not familiar with these processes, please complete the Flow Builder module in Salesforce Trailhead, which was mentioned at the beginning of this article as a prerequisite.
____________________
- This article was new with the Magnolia - Home release.
Comments
0 comments
Please sign in to leave a comment.