getRatingInput(insGetRatingInputInputRepresentation)

Generate a sample rating input for the specified insurance product, and use the generated rating input as the request body in the Insurance Product Rating API after replacing sample values with real data.

API Version 

68.0

Requires Chatter 

No

Signature 

public static ConnectApi.InsGetRatingInputRepresentation getRatingInput(ConnectApi.InsGetRatingInputInputRepresentation insGetRatingInputInputRepresentation)

Parameters 

insGetRatingInputInputRepresentation

Type: ConnectApi.InsGet​Rating​Input​InputRepresentation

Required. Input that identifies the root Product2 record for which to generate a sample rating input payload.

Return Value 

Type: ConnectApi.InsGet​Rating​Input​Representation

Usage 

Use this method at design time to generate a sample rating input payload for a root insurance product. Provide a Product2 ID. The method traverses the product hierarchy, including bundles, components, and attributes, builds a fully populated sample request body suitable for the Insurance Product Rating API, and returns it as a JSON string in ratingInput.

The generated payload includes product codes, instance keys, and attribute codes with sample values. Parse the ratingInput string, replace sample values with real data, and then submit the result to the product-rating API. Review additionalDetails for guidance about fields the sample may omit, such as transactionType.

When generation succeeds, ratingInput contains the sample payload and errors is empty or null. When generation fails, errors lists the failures. Examples include:

  • SF-INS-DSAV-00013 — a product ID is required. Specify a valid product ID.
  • SF-INS-DSAV-00014 — the specified product ID doesn’t exist or isn’t accessible.

Example 

This sample generates a rating input payload from Apex.

1ConnectApi.InsGetRatingInputInputRepresentation input =
2    new ConnectApi.InsGetRatingInputInputRepresentation();
3input.productId = '01txx0000006i3DAAQ';
4
5ConnectApi.InsGetRatingInputRepresentation result =
6    ConnectApi.InsuranceDesignAdvisorFamily.getRatingInput(input);
7
8System.debug('ratingInput=' + result.ratingInput);
9System.debug('additionalDetails=' + result.additionalDetails);
10System.debug('errors=' + result.errors);