Prerequisites
- Familiarization with Accounting Seed Native Tax (Line Level Posting) calculation
- Prior to reading this article, we recommend that you become familiar with the Salesforce Flow by completing the Flow Builder module in Salesforce Trailhead.
Overview
You can now declaratively leverage Billing tax calculations for Line Level Posting. The example Flow, Billing Calculate Tax, includes the new Accounting Seed CalcTax Flow Action as an example of how this new feature can be used.
The CalcTax Flow Action can easily be utilized from Record-Triggered and/or Schedule-Triggered flows to run a specified Financial Report based upon a record event or schedule. The provided Record-Triggered flow is an example of how to utilize the action.
Calc Tax Flow Considerations
The current implementation of TaxServiceInvocable only supports Billings for Line Level Posting.
Note: When a Product on a Billing Line is not set up to be taxable, an error message will display to indicate that there is no taxable Product associated with a Billing Line. Additionally, when there are no Products on any Billing Lines and the flow is run, an error message will display to indicate that no Billing Lines were found with an associated Product.
Note: Header Level Posting does not require this since taxes are calculated when records change.
Calc Tax Flow Action
Input Values
Name | Type | Values |
SourceDocs | List<sObject> |
Output Values
Name | Type | Values |
isSuccess | Boolean | |
results | List<TaxServiceResultLineType> | IsSuccess - True or False sourceRecordId – record Id of the source doc that was processed |
Working with sample Billing Calculate Tax Flow
The provided sample Flow - Billing Calculate Tax, invokes the new CalcTax Action as seen below. Failure and success notifications based upon the CalcTax outcome are optional, but are provided in the sample flow.
Note: Click here to view the above image in full screen.
Add CalcTax Flow Action to a Flow
The CalcTax Action can be added to a Salesforce Flow.
- Open the Flow for which you want to add the Run Report Action. In the example flow, a record-triggered flow is being used on the Billing Object. Select Setup | Flows | New Flow | Record Triggered Flow, and click Create.
- Select the Billing object
- Select the A record is updated radio button
- From the Condition Requirements drop-down list, select All Conditions Are Met (AND)
- In the Field textbox, select AcctSeed_Sub_Total_c
- In the Operator drop-down list, select Is Changed, and select the Value as True
- For a Record-Triggered flow, be sure to select the Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed checkbox that displays at the bottom of the configuration screen.
- All flow actions should be added to the Run Asynchronously branch of the flow.
Note: Click here to view the above image in full screen.
- Click Done.
- Select Add element | Get Records to get a List of Billings required for the new flow action.
- Enter Billings in the Label textbox, and press Enter to automatically display the API Name.
- Select the Billing object.
- From the Condition Requirements drop-down list, select All Conditions Are Met (AND)
- In the Field textbox, select Id.
- In the Operator drop-down list, select Equals, and select the Value as Record> Record Id.
- Select the All records radio button.
Note: Click here to view the above image in full screen.
- Click Done.
- Select Add Element | Action.
- Select Calculate Tax Source Documents from the Action drop-down list.
- Enter Calculate Taxes as the Label, and press Enter to automatically display the API Name.
- Select the Billing object
- (Optional) Enter a Description
- Select Billing (AcctSeed_Billing__c)
- SourceDocs: List of Billings from previous step
Note: Click here to view the above image in full screen.
- Click Advanced, and select the Manually assign variables checkbox.
- Calc Tax Success: create a new boolean variable
- Results: List<TaxServiceResultLineType>: create an Apex defined variable type for this, which allows multiple values
- Click Done.
Note: For a basic implementation, this is all that is needed in order to calculate taxes from a trigger based flow.
- (Optional) In the example below, we loop over the variable returned from the Calc Tax action and if any Billings failed, we add a task to the Billing record.
- Select Add Element | Loop.
- Select Add Element | Decision.
Note: Click here to view the above image in full screen.
- If the Current Item from Loop, isSuccess equals false then there was an issue calculating the tax for this specific Billing.
- On the Failure Path from the Decision select Add Element | New Task and create a new task for the Billing record.
- Select Add Element | Loop.
____________________
Winter '24 Release
This article was new with the Winter '24 Release
Comments
0 comments
Please sign in to leave a comment.