This API retrieves the constraints rules applied to a cart.

APISignature
getConstraintRuleResultwebService static Apttus_CPQApi.CPQ.ConstraintResultDO getConstraintRuleResult(Id cartId)


Parameters
NameTypeDescription
CartIdIDThe cart ID


Response Data Object - Apttus_CPQApi.CPQ.ConstraintResultDO
FieldTypeDescription
CartIdIDThe Id of the cart.
ConstraintRuleActionsList<Apttus_CPQApi.CPQ.AppliedActionDO>The list of constraint rule action applied to the cart.
HasPendingErrorBooleanIndicates whether there are pending rule actions that are error type.
HasPendingWarningBooleanIndicates whether there are pending rule actions that are warning type.
NeedMoreProcessingBooleanIndicates whether the rule required more processing.




Response Data Object - Apttus_CPQApi.CPQ.AppliedActionDO 
FieldTypeDescription
ActionIntentStringThe action intent of the applied constraint rule.
ActionTypeStringThe action type of the applied constraint rule.
AffectedPrimaryNumbersListThe primary line number of the line item the constraint rule is applied on.
AffectedProductIdsListIDs of the line item the constraint rule is applied on.
AppliedActionIdIDThe ID of the constraint rule action applied on the cart.
AppliedRuleInfoIdIDThe Applied Rule Info ID of the constraint rule action
CartIdIDThe ID of the cart.
ConstraintRuleActionIdIDThe ID of the constraint rule action.
CriteriaFieldsListThe criteria fields in the constraint rule action.
IsAutoExecutedBooleanIndicates whether the auto-execution is enabled for the constraint rule.
IsHideMessageBooleanIndicates whether the messages are hidden.
IsIgnoredByUserBooleanIndicates whether ignoring the constraint rule is allowed.
IsPendingBooleanIndicates whether any action is pending from the user to execute the constraint rule.
IsShowPromptBooleanIndicates whether prompt is required.
IsTargetOptionProductBooleanIndicates whether the target include or exclude products should be present in the shopping cart as options.
IsTargetPrimaryProductBooleanIndicates whether the include or exclude products should be present in the shopping cart as primary lines.
MatchCountRuleString
MessageStringThe message added to the constraint rule action.
MessageTypeStringThe type of the message defined in the constraint rule action.
SuggestedProductIdsListThe IDs of the product suggested by rule action definition to be included in the cart.
TargetBundleNumberIntegerThe parent bundle number of the included or excluded products. For the products that are not option, the number is set as zero which represents the cart as the parent.
TriggeringPrimaryNumbersListThe primary numbers of the line items that have triggered the rule action.
TriggeringProductIdsListThe list of ids representing the products that caused the rule to trigger


Code Sample

The sample below enables you to fetch the constraint rules applied to a cart with a specific Cart ID. Use this API when you want to view the constraint rules applied to a cart. For example, to generate a report about the constraint rules applied to a cart, you can fetch the constraint rules using this API.
 

public void getConstraintRuleResult()
{
	Integer numErrors = 0;
	
	Apttus_CPQApi.CPQ.ConstraintResultDO constraintResult = Apttus_CPQApi.CPQWebService.getConstraintRuleResult(cartID);
	
	List<Apttus_CPQApi.CPQ.AppliedActionDO> appliedActionDOList = constraintResult.ConstraintRuleActions;
	
	for(Apttus_CPQApi.CPQ.AppliedActionDO appliedActDO:appliedActionDOList) 
	{
		ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, appliedActDO.Message));  
		if(appliedActDO.MessageType.equals('Error') && appliedActDO.IsPending) 
		{
			numErrors++;
		}
	}
}
CODE

Integration Details

Use the following information in your integrations with CPQ Web Services API. Refer to Integrating Conga with External Systems for information on how to get started.

Response/Request XML

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService">
   <soapenv:Header>
      <cpq:SessionHeader>
         <cpq:sessionId>00D4P000000z7dE!AQQAQAHIR1W9.1as89Auz.CvNYxqyg56gLLWgUtP5VZxidvTsb1DpQZpmyDuqZOiF4VctBp3jhhJIxG9oRQ4A4F9h98N0inT</cpq:sessionId>
      </cpq:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <cpq:getConstraintRuleResult>
         <cpq:cartId>a1l4P00000Bg7D9QAJ</cpq:cartId>
      </cpq:getConstraintRuleResult>
   </soapenv:Body>
</soapenv:Envelope>
XML

Example Response

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService" xmlns:ConstraintResultDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getConstraintRuleResultResponse>
         <result>
            <ConstraintResultDO:CartId xsi:nil="true"/>
            <ConstraintResultDO:ConstraintRuleActions>
               <ConstraintResultDO:ActionIntent>Show Message</ConstraintResultDO:ActionIntent>
               <ConstraintResultDO:ActionType>Exclusion</ConstraintResultDO:ActionType>
               <ConstraintResultDO:AffectedPrimaryNumbers>13</ConstraintResultDO:AffectedPrimaryNumbers>
               <ConstraintResultDO:AffectedProductIds>01t4P000008OfIrQAK</ConstraintResultDO:AffectedProductIds>
               <ConstraintResultDO:AppliedActionId>a0y4P00000GHs7nQAD</ConstraintResultDO:AppliedActionId>
               <ConstraintResultDO:AppliedRuleInfoId>a0z4P00000JyUToQAN</ConstraintResultDO:AppliedRuleInfoId>
               <ConstraintResultDO:CartId>a1l4P00000Bg7D9QAJ</ConstraintResultDO:CartId>
               <ConstraintResultDO:ConstraintRuleActionId>a1H4P000005JdfVUAS</ConstraintResultDO:ConstraintRuleActionId>
               <ConstraintResultDO:IsAutoExecuted>false</ConstraintResultDO:IsAutoExecuted>
               <ConstraintResultDO:IsHideMessage>false</ConstraintResultDO:IsHideMessage>
               <ConstraintResultDO:IsIgnoredByUser>false</ConstraintResultDO:IsIgnoredByUser>
               <ConstraintResultDO:IsPending>true</ConstraintResultDO:IsPending>
               <ConstraintResultDO:IsShowPrompt>false</ConstraintResultDO:IsShowPrompt>
               <ConstraintResultDO:IsTargetOptionProduct>true</ConstraintResultDO:IsTargetOptionProduct>
               <ConstraintResultDO:IsTargetPrimaryProduct>true</ConstraintResultDO:IsTargetPrimaryProduct>
               <ConstraintResultDO:MatchCountRule xsi:nil="true"/>
               <ConstraintResultDO:Message>The MSM410 Access Point is not compatible with the selected blade server</ConstraintResultDO:Message>
               <ConstraintResultDO:MessageType>Error</ConstraintResultDO:MessageType>
               <ConstraintResultDO:SuggestedProductIds>01t4P000008OfIrQAK</ConstraintResultDO:SuggestedProductIds>
               <ConstraintResultDO:TargetBundleNumber>0</ConstraintResultDO:TargetBundleNumber>
               <ConstraintResultDO:TriggeringPrimaryNumbers>14</ConstraintResultDO:TriggeringPrimaryNumbers>
               <ConstraintResultDO:TriggeringProductIds>01t4P000008OfIzQAK</ConstraintResultDO:TriggeringProductIds>
            </ConstraintResultDO:ConstraintRuleActions>
            <ConstraintResultDO:HasPendingError>true</ConstraintResultDO:HasPendingError>
            <ConstraintResultDO:HasPendingWarning>false</ConstraintResultDO:HasPendingWarning>
            <ConstraintResultDO:NeedMoreProcessing>false</ConstraintResultDO:NeedMoreProcessing>
         </result>
      </getConstraintRuleResultResponse>
   </soapenv:Body>
</soapenv:Envelope>
XML