Loading
Prepare for Email to Become the Default Login ExperienceRead More
The online Trailblazer Community becomes read-only Oct 30, 2026Read More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Insurance
InsurancePolicyTransactionService:reverseTransaction

InsurancePolicyTransactionService:reverseTransaction

Use this service to reverse an insurance policy transaction.

This service creates a Reversal transaction for an insurance policy transaction. It also recreates the policy based on a snapshot of the policy from the time the original transaction was created.

Class: InsurancePolicyTransactionService

Method: reverseTransaction

How It Works

To reverse an insurance policy transaction, this service:

  1. Validates that the given input Id is an instance of the InsurancePolicyTransaction object.

  2. Retrieves the InsurancePolicyTransaction record and validates that the transaction to reverse is:

  3. Creates a Reversal transaction record with:

    • Negative amounts from the original transaction.

    • transactionDate and postDate values based on specified options.

    • Transaction type and name set to Reversal.

    • parentTransactionId equal to the transaction ID of the transaction getting reversed.

    • policyVersionId equal to the policy ID of the snapshot.

  4. Sets the status of the current policy and the snapshot policy to Reversed.

  5. Recreates the policy based on the snapshot. The service:

    • Removes existing IDs so that new records are created when saving.

    • Recreates Payment and Revenue schedules via delete-insert, preserving the original lookup to the transactions.

  6. Calls InsuranceCommissionDataService.reverseCommissions to create and save a reversal commission for the commission related to the original transaction.

Inputs

Input

Description

Id

The ID of the InsurancePolicyTransaction to reverse. Invalid values generate an error.

Remote Options

All remote options are optional.

Remote Option

Description

effectiveDate

Value assigned to reversal transaction's transaction date

postDate

Post date for the reversal transaction (Default: effectiveDate)

getDRBundleName

Omnistudio Data Mapper bundle for retrieving the InsurancePolicy and InsurancePolicyTransaction records needed to process the reversal

getCustomClassName

Class for retrieving InsurancePolicy and InsurancePolicyTransaction records needed to process the reversal (Default: GetPolicyTransactionReversalFields)

postPolicyDRBundleName

Data Mapper bundle for creating and updating InsurancePolicy records

postPolicyCustomClassName

Class for creating and updating InsurancePolicy records (Default: PostInsurancePolicy)

postTxnDRBundleName

Data Mapper bundle for creating and updating InsurancePolicyTransaction records

postTxnCustomClassName

Class for creating and updating InsurancePolicyTransaction records (Default: PostInsurancePolicyTransaction)

Output

Output

Description

transactionIdForReversal

ID of the reversal transaction record. This value matches the input Id.

reversalCommissionId

ID of the reversal commission record

reversedCommissionAmount

Amount of the reversed commission

Input JSON

Here's how to format input JSON.

{
    "Id": <transaction id>
}

Here's how to format options.

{
    "effectiveDate": <Date>,
    "postDate" : <Date>,
    "getCustomClassname" : <String>,
    "postPolicyCustomClassName" : <String>,
    "postTxnCustomClassName" : <String>
}

Here's a sample of input.

{
    "Id": "0k9R000000003KjIAI"
}

And here's a sample of input options.

{
    "effectiveDate": "4/1/2021",
    "postDate" : "4/5/2021",
    "getCustomClassname" : "GetPolicyTransactionReversalFields",
    "postPolicyCustomClassName" : "PostInsurancePolicy",
    "postTxnCustomClassName" : "PostInsurancePolicyTransaction"
}

Output JSON

Here's the format of output JSON.

{
    "transactionIdForReversal": <transaction id>,
    "reversalCommissionId": <commission id>,
    "reversedCommissionAmount": <Decimal>
}

Here's a sample of output.

{
    "transactionIdForReversal": "0k9R000000003KjIAI",
    "reversalCommissionId": "0k9R000000003KjIAI",
    "reversedCommissionAmount": 123.00
}
 
Loading
Salesforce Help | Article