Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

download

Validation Callback Class

Validation Callback provides a mechanism to implement custom validations on the line items in the cart. Validations are any constraints you define on the line item to restrict the selection of that line item based on any condition or criteria. When you define validations, CPQ checks if the condition or the criteria is satisfied and displays an error message accordingly. For example, you can validate if the Quantity field for any product is negative and prevent the sales rep from finalizing the cart.
Note: Validation callback logic now triggers warning messages along with error messages. You can proceed with the quoting process even when warnings are present, without triggering an approval check.

Validation Callback applies validation on the following aspects in the configuration: ​

  • Entire cart
  • Line items in the cart
  • Price Ramps​

To use the Validation Callback you must create a custom C# that implements the IValidationCallback interface and register the custom C# with Validation Callback Class. You must write your custom logic in the custom C# language.

The following methods are available in the IValidationCallback interface:

Method

Signature

Description

BeforePricingValidationAsync

BeforePricingValidationAsync(IActionRequest request)

This extension point is utilized for creating pre-price validation callbacks.

FinalizeValidationAsync

FinalizeValidationAsync(IActionRequest request)

This hook point is used to write validation callback code for finalize event.

OnCartValidationAsync

OnCartValidationAsync(IActionRequest actionRequest)

This is generic method for validation callback.

The following is an example of the custom logic you can implement using Validation example.

Example

The given code example implements the method of IValidationCallback interface. using Conga.Revenue.Common.Callback.Messages; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Conga.Revenue.Common.Callback { public interface IValidationCallback { /// <summary> /// This extension point is used to write prepricing validation callback /// </summary> /// <param name="actionRequest">This will have cart context where lines are there.</param> public Task BeforePricingValidationAsync(IActionRequest actionRequest); /// <summary> /// This hookpoint is used to write validation callback code for finalize event /// </summary> /// <param name="actionRequest"></param> /// <returns></returns> public Task FinalizeValidationAsync(IActionRequest actionRequest); /// <summary> /// This is generic method for validation callback /// </summary> /// <param name="actionRequest"></param> /// <returns></returns> public Task OnCartValidationAsync(IActionRequest actionRequest); } }