You use this API to apply constraint rules to the bundles you added to the cart.

APISignature
applyConstraintRulesOnAddBundlewebService static Apttus_Config2.ConstraintWebService2.ConstraintResult2 applyConstraintRulesOnAddBundle(Id cartId, Decimal lineNumber)



Parameters
NameTypeDescription
cartIdIdThe Id of the cart you added products to.
lineNumberDecimalThe line number of the bundle added to the cart



Response Parameter - Apttus_Config2.ConstraintWebService2.ConstraintResult2
FieldTypeDescription
IsSuccessBooleanIndicates whether the CPQ successfully applied the constraint rule


Code Sample

The sample below enables you to apply a constraint rule to the bundle line item in the given cart.

public Boolean associateConstraintRulesOnAddBundle(String proposalID, String productId)  
{

	Apttus_Config2__ProductConfiguration__c cart = [SELECT Apttus_Config2__PriceListId__c, Id
													FROM Apttus_Config2__ProductConfiguration__c 
													WHERE Apttus_QPConfig__Proposald__c =: proposalID ]

	//Fetch All products from Product Configuration
	Apttus_Config2__LineItem__c lineItemSO = 	[SELECT Apttus_Config2__ProductID__c,  Apttus_Config2__LineNumber__c 
													FROM Apttus_Config2__LineItem__c 
													WHERE Apttus_Config2__ConfigurationId__c = :cart.Id
													AND Apttus_Config2__ProductID__c =: productid limit 1];
						
	Apttus_Config2.ConstraintWebService2.ConstraintResult2 response = Apttus_Config2.ConstraintWebService2.applyConstraintRulesOnAddBundle(cart.Id, lineItemSO.Apttus_Config2__LineNumber__c);
	return response.isSuccess;
}
CODE