Applying Constraint Rule to Bundles Added to the Cart
You use this API to apply constraint rules to the bundles you added to the cart.
API |
Signature |
---|---|
applyConstraintRulesOnAddBundle |
webService static Apttus_Config2.ConstraintWebService2.ConstraintResult2 applyConstraintRulesOnAddBundle(Id cartId, Decimal lineNumber) |
Parameters |
||
---|---|---|
Name |
Type |
Description |
cartId | Id |
The Id of the cart you added products to. |
lineNumber | Decimal |
The line number of the bundle added to the cart |
Response Parameter - Apttus_Config2.ConstraintWebService2.ConstraintResult2 |
||
---|---|---|
Field |
Type |
Description |
IsSuccess | Boolean |
Indicates 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;
}