API Version
68.0
Requires Chatter
No
Signature
public static ConnectApi.InsProductDiscoveryValidationRepresentation validateProductDiscovery(ConnectApi.InsProductDiscoveryValidationInputRepresentation insProductDiscoveryValidationInputRepresentation)
Parameters
- insProductDiscoveryValidationInputRepresentation
- Type: ConnectApi.InsProductDiscoveryValidationInputRepresentation
- Required. Input that identifies the insurance product to validate for discovery setup. Provide at least one of product ID, product code, or developer name.
Return Value
Type: ConnectApi.InsProductDiscoveryValidationRepresentation
Usage
Use this method at design time to confirm that a product’s discovery-related setup is correct before runtime product discovery. The method resolves the target product from the provided identifier and validates pricing, price book entries, and selling model configurations that would otherwise surface as failures during discovery.
Validations include confirming that at least one product identifier is provided; that the product exists; that an active price book entry with a unit price greater than zero is associated with an active price book; and that the product is associated with an active product selling model option. When the Select Pricing Procedure preference is enabled, the method also checks that a product discovery pricing procedure is configured with an active version, that an active decision table with source object PricebookEntry exists, and that the product’s price book entry can be resolved by that decision table.
When the discovery setup is valid, isValid is true. When setup fails, isValid is false and errors lists the failures. Examples include:
- SF-INS-DSAV-00038 — no product identifier was provided.
- SF-INS-DSAV-00044 — no product was found for the specified identifier.
- SF-INS-DSAV-00011 — the product doesn’t have a price book entry.
- SF-INS-DSAV-00004 — the product isn’t associated with a product selling model option.
- SF-INS-DSAV-00040 — the product discovery pricing procedure isn’t configured.
- SF-INS-DSAV-00047 — no active decision table with source object PricebookEntry was found.
Informational messages can appear in infos. For example, SF-INS-DSAV-00042 indicates that pricing is disabled for product discovery and pricing procedure validation was skipped, and SF-INS-DSAV-00043 reminds you to refresh decision tables after recent changes.
Example
This sample validates product discovery setup from Apex.
ConnectApi.InsProductDiscoveryValidationInputRepresentation input =
new ConnectApi.InsProductDiscoveryValidationInputRepresentation();
input.productId = '01txx0000006i3DAAQ';
ConnectApi.InsProductDiscoveryValidationRepresentation result =
ConnectApi.InsuranceDesignAdvisorFamily.validateProductDiscovery(input);
System.debug('isValid=' + result.isValid);
System.debug('errors=' + result.errors);
System.debug('infos=' + result.infos);