You use this API to retrieve IDs of the products added to the cart by the auto-inclusion constraint rule.

APISignature
getAutoIncludedProductIdsForCartwebService static List> getAutoIncludedProductIdsForCart(Id cartId)



Parameters
NameTypeDescription
cartIdIdThe Id of the cart you added products to.



Response Parameter
FieldTypeDescription
responseList<list<ID>>The IDs of products auto-included to the cart


Code Sample

The sample below retrieves the ID of the products auto-included to cart by the auto-inclusion type constraint rules. The list of ID list is returned after the execution of this API. The ID list contains the ID of the condition products and the list of the ID of associated action products.

public Map<Id, Set<Id>> getAutoIncludedProductsForCart(String proposalID)
{

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

	List<list<id>> response = Apttus_Config2.ConstraintWebService2. getAutoIncludedProductIdsForCart (cart.Id);
	
	Map<Id, Set<Id>> autoIncludedIdsByTriggeringProductId  = new Map<Id, Set<Id>> ();
	for (list<id> productIds : response)
	{
		
		for (integer index=1; index <productIds.size() ; index ++) 
		{
			if (autoIncludedIdsByTriggeringProductId.containsKey(productIds[0]))
			{
				autoIncludedIdsByTriggeringProductId.get(productIds[0]).add(productIds[index]);
			}
			else 
			{
				autoIncludedIdsByTriggeringProductId.put(productIds[0], new set<Id> {productIds[index]});
			}
		}
	}
	return autoIncludedIdsByTriggeringProductId;
}
CODE