Loading
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Insurance
InsCommissionService:calculate

InsCommissionService:calculate

Use this service to calculate the commission for a producer.

Class: InsCommissionService

Method: calculate

Description

This service uses details about the producer, the insurance product, and the commissionable event to calculate a commission for a producer.

How It Works

To calculate a commission, this service:

  1. Accepts productionCode, producerId, productId, commissionableEvent, context, and effectiveDate inputs to find the appropriate CommissionSchedule to use for the calculation.

  2. Calculates the commission based on the Commission Schedule.

  3. Evaluates the commission to determine whether it's a chargeback (a returned commission amount).

    • If the commissionable amount is negative, the service treats the commission as a chargeback.

    • If the commission isn't a chargeback, the service compares the calculated commission amount to minimum and maximum commission amounts. If the calculated amount it too low or too high, the service returns the minimum or maximum amount instead of the calculated amount.

  4. Returns the commission amount, the ID of the commission schedule used to calculate it, and the minimum and maximum amounts that apply to this commission.

Inputs

Input

Description

productionCode

Optional.

The production code name, not the ID, for the processing producer.

producerId

Optional.

The ID of the processing producer.

productId

Required.

The ID of the product for which the commission is paid.

commissionableEvent

Optional.

The event or transaction that triggers a commission calculation (for example, Quote, Sold Policy, or Changed/Endorsed).

effectiveDate

Optional.

The effective date of the commission payment. If null, the service uses today's date.

context

Required.

Field name and value pairs for the record on which commission is calculated. You must:

  • Include a namespace in the API name if one exists.

  • Include objectId, that is, the ID of the record for which the commission is calculated.

Format without lookup field:

{ objectAPI.fieldAPI : fieldValue }

Format with lookup field:

{ objectAPI.relationshipAPI.fieldAPI : fieldValue }

You can specify up to two levels of fields if you format the input with a lookup field.

commissionableAmount

Optional.

The amount on which the commission calculation is based.

Input JSON

Here's how to format input JSON.

{
   "productionCode": ProductionCode.Name,
   "producerId": Producer.Id,
   "product2Id": Product2.Id,
   "commissionableEvent": event type,
   "commissionableAmount": amount of the transaction,
   "context": {
      "objectId": ID of applicable object used,
	  "objectAPI.fieldAPI" : value
   }
}

This sample calculates a commission for an endorsement.

{
   "productionCode":AX001,
   "producerId":ay001jh002,
   "product2Id":az011jh022,
   "commissionableEvent":"Endorsement",
   "commissionableAmount":500,
   "context":{
      "Quote.vlocity_ins__TotalPremiumforTerm__c":100,
      "QuoteLineItem.vlocity_ins__GroupClassId__r.vlocity_ins__ClassCode__c":"Managers",
      "QuoteLineItem.vlocity_ins__FeeAmount__c":5,
      "objectId":ax003jh001
   }
}

Output JSON

Here's the format of output JSON.

{
   "commissionAmount": amount,
   "commissionScheduleId": ID of the commission schedule used,
   "minCommissionAmount": CommissionScheduleAssignment.MinCommissionAmount,
   "maxCommissionAmount": CommissionScheduleAssignment.MaxCommissionAmount
}

Here's sample output that shows the calculated amount ($167) is within the range defined by minimum and maximum values ($100-$500).

{
   "commissionAmount":167,
   "commissionScheduleId":"ab001od002",
   "minCommissionAmount":100,
   "maxCommissionAmount":500
}
 
Loading
Salesforce Help | Article