The table below provides a comprehensive overview of all fields and relationships for the Invoice object in Maica. Please refer to the table below for detailed information.
Click here to view and download the complete Invoice Schema.
Validation Rules
The list below outlines the Validation Rules applied to the Invoice Object in Maica.
Please refer to the list below for more detailed information on each Validation Rule.
Funding Type Required When Invoice is Saved
This rule ensures that the Funding Type is populated when the Invoice is saved.
Validation Rule Detail
Rule Name
VAL_INVOICE_0001
Error Message
VAL_0001: Please ensure that the Funding Type is provided.
Error Location
Funding Type
Error Condition Formula
ISPICKVAL(maica_cc__Funding_Type__c, "")
Restrict Invoice Amount Change
This rule ensures that the Invoice Total Amount cannot be changed when a corresponding Stripe Invoice exists.
Validation Rule Detail
Rule Name
Restrict_Invoice_Amount_Change
Error Message
The Total Amount cannot be be updated as there is a corresponding Stripe Invoice
The list below outlines the Flows applied to the Invoice Object in Maica.
Please refer to the list below for more detailed information on each Flow.
Cancel Invoice
This flow is designed to cancel an invoice by updating its status to "Cancelled."
Flow Detail
Flow Label
Maica - Cancel Invoice
API Name
maica__Maica_Cancel_Invoice
Type
Screen Flow
Flow Summary
This flow is designed to cancel an invoice by updating its status to "Cancelled".
Retrieves an invoice.
Checks the invoice status.
Allows the user to confirm cancellation.
Updates the invoice status to "Cancelled".
Notifies the user of successful cancellation.
Flow Description
Start (Record-Triggered Flow):
Object: Invoice__c
Trigger: When the invoice record is updated or created.
Input Variable: recordId
Get Invoice (Record Lookup):
Filters: Retrieves the invoice record where the Id matches recordId.
Connector: Proceeds to check the invoice status.
Invoice Status (Decision):
Conditions: Checks if the invoice status is "Cancelled".
If "Cancelled": Displays the "Invoice Cancelled" screen.
If not "Cancelled": Proceeds to the "Cancel Invoice" screen.
Cancel Invoice (Screen):
Displays a confirmation message asking the user to confirm the cancellation of the invoice.
Connector: Proceeds to set the invoice as cancelled upon confirmation.
Set Invoice Cancelled (Assignment):
Sets the Cancelled__c field of the invoice to true.
Connector: Proceeds to update the invoice.
Update Invoice (Record Update):
Updates the invoice record with the cancelled status.
Connector: Proceeds to display the "Invoice Cancelled" screen.
Invoice Cancelled (Screen):
Displays a message confirming that the invoice has been cancelled.
Invoice Status Management
This flow evaluates and updates the status of an invoice based on its payment details and other related conditions.
Flow Detail
Flow Label
Maica - Invoice Status Management
API Name
maica__Invoice_Status_Management
Type
Autolaunched Flow
Flow Summary
This flow ensures that the invoice status is accurately updated based on the payment details and other conditions.
Starts on invoice creation or update.
Evaluates the status based on various conditions.
Assigns the appropriate status (Cancelled, Not Paid, Partially Paid, Fully Paid).
Flow Description
Start (Record-Triggered Flow):
The flow begins when an invoice is created or updated.
It is triggered before the record is saved.
Status Evaluation (Decision):
The flow checks the status of the invoice based on various conditions:
If the invoice is cancelled, it proceeds to set the status to "Cancelled".
If all line items are not paid, it proceeds to set the status to "Not Paid".
If the invoice is partially paid and managed by an agency, it checks further conditions and then sets the status to "Partially Paid".
If the invoice is fully paid and managed by an agency, it checks further conditions and then sets the status to "Fully Paid".
For non-agency managed invoices, it similarly checks and sets the status to "Partially Paid" or "Fully Paid" based on payment details.
Set Cancelled (Assignment):
Sets the invoice status to "Cancelled".
Set Not Paid Status (Assignment):
Sets the invoice status to "Not Paid".
Set Partially Paid Status (Assignment):
Sets the invoice status to "Partially Paid".
Set Fully Paid Status (Assignment):
Sets the invoice status to "Fully Paid".
Trigger Handlers
The table below outlines the Trigger Handlers applied to the Invoice Object in Maica and their Load Order.
Trigger Handler
Load Order
1
1
1
2
10
Please refer to the list below for more detailed information on each Trigger Handler.
Invoice Manage Claim Schedule
This trigger is designed to manage the claim schedule for invoices in Maica.
Detail
Load Order
1
Label
InvoiceManageClaimSchedule_MDTM
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the InvoiceManageClaimSchedule_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the claim schedule process for invoices.
Trigger Conditions:
When a new invoice (maica__Invoice__c) is created.
When an existing invoice is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Logic Explanation
Initialisation:
When an invoice record is created or updated, the trigger is initialised. The InvoiceManageClaimSchedule_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 1.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the InvoiceManageClaimSchedule_MDTM class.
The class methods perform the following steps:
Validation: The invoice data is validated to ensure it is complete and accurate.
Claim Scheduling: Based on the invoice details, claims are scheduled to reflect the payment plan and due dates.
Update: The invoice record is updated with the newly scheduled claim data.
Trigger Outcome:
Once executed, the trigger ensures that each invoice has its claim schedule managed correctly, according to the logic specified in the handler class. This helps maintain accurate claim schedule data for invoices.
Invoice Next Schedule Date
This trigger is designed to manage the next scheduled date for invoices in Maica. This ensures correct calculation of the next scheduled date for invoices, maintaining accurate scheduling data.
Detail
Load Order
1
Label
InvoiceNextScheduledDate_MDTM
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the InvoiceNextScheduledDate_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the next scheduled date process for invoices.
Trigger Conditions:
When a new invoice (maica__Invoice__c) is created.
When an existing invoice is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Initialisation:
When an invoice record is created or updated, the trigger is initialised. The InvoiceNextScheduledDate_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 1.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the InvoiceNextScheduledDate_MDTM class.
The class methods perform the following steps:
Validation: The invoice data is validated to ensure it is complete and accurate.
Date Calculation: Based on the invoice details, the next scheduled date is calculated to reflect the payment plan and due dates.
Update: The invoice record is updated with the newly calculated next scheduled date.
Trigger Outcome:
Once executed, the trigger ensures that each invoice has its next scheduled date calculated correctly, according to the logic specified in the handler class. This helps maintain accurate scheduling data for invoices.
Invoice Defaults
This trigger is designed to manage the default values for invoices in Maica.
Detail
Load Order
1
Label
InvoiceDefaults_MDTM
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the InvoiceDefaults_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the setting of default values for invoices.
Trigger Conditions:
When a new invoice (maica__Invoice__c) is created.
When an existing invoice is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Logic Explanation
Initialisation:
When an invoice record is created or updated, the trigger is initialised. The InvoiceDefaults_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 1.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the InvoiceDefaults_MDTM class.
The class methods perform the following steps:
Validation: The invoice data is validated to ensure it is complete and accurate.
Default Setting: Based on predefined criteria, default values such as payment terms, due dates, and invoice status are set.
Update: The invoice record is updated with the newly set default values.
Trigger Outcome:
Once executed, the trigger ensures that each invoice has its default values set correctly, according to the logic specified in the handler class. This helps maintain accurate and consistent data for invoices.
Invoice Rollup Expenditure
This trigger is designed to manage the rollup of expenditures for invoices in Maica.
Detail
Load Order
2
Label
InvoiceRollupExpenditure_MDTM
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the InvoiceRollupExpenditure_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the rollup expenditure process for invoices.
Trigger Conditions:
When a new invoice (maica__Invoice__c) is created.
When an existing invoice is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Logic Explanation
Initialisation:
When an invoice record is created or updated, the trigger is initialised. The InvoiceRollupExpenditure_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 2.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the InvoiceRollupExpenditure_MDTM class.
The class methods perform the following steps:
Validation: The expenditure data is validated to ensure it is complete and accurate.
Calculation: The total expenditure is calculated based on predefined criteria such as item type and financial rules.
Update: The invoice record is updated with the newly calculated rolled-up expenditure data.
Trigger Outcome:
Once executed, the trigger ensures that each invoice has its expenditures rolled up correctly, according to the logic specified in the handler class. This helps maintain accurate financial data for invoices.
Invoice Claim
This trigger is designed to manage the claim process for invoices in Maica. This ensures correct generation of claims for invoices, maintaining accurate claim data.
Detail
Load Order
10
Label
InvoiceClaim_MDTM
Execution, Logic & Outcome
Execution of Trigger Logic:
The trigger logic defined in the InvoiceClaim_MDTM class is executed when the trigger conditions are met. The class contains the code that manages the claim process for invoices.
Trigger Conditions:
When a new invoice (maica__Invoice__c) is created.
When an existing invoice is updated.
Any specific field changes that are monitored by the trigger (defined in the handler class).
Logic Explanation
Initialisation:
When an invoice record is created or updated, the trigger is initialised. The InvoiceClaim_MDTM metadata type configuration is loaded, ensuring that the trigger is active (Active__c is true) and has the correct load order (Load_Order__c is 10.0).
Trigger Execution:
Upon initialisation, the trigger executes the logic defined in the InvoiceClaim_MDTM class.
The class methods perform the following steps:
Validation: The invoice data is validated to ensure it is complete and accurate.
Claim Generation: Based on the invoice details, claims are generated to reflect the amounts and payment plans specified.
Update: The invoice record is updated with the newly generated claim data.
Trigger Outcome:
Once executed, the trigger ensures that each invoice has its claims processed correctly, according to the logic specified in the handler class. This helps maintain accurate claim data for invoices.