PDF
Download PDF
Download page Retrieving Constraint Rules Results.
Retrieving Constraint Rules Results
This API retrieves the constraints rules applied to a cart.
API | Signature |
---|---|
getConstraintRuleResult | webService static Apttus_CPQApi.CPQ.ConstraintResultDO getConstraintRuleResult(Id cartId) |
Parameters | ||
---|---|---|
Name | Type | Description |
CartId | ID | The cart ID |
Response Data Object - Apttus_CPQApi.CPQ.ConstraintResultDO | ||
---|---|---|
Field | Type | Description |
CartId | ID | The Id of the cart. |
ConstraintRuleActions | List<Apttus_CPQApi.CPQ.AppliedActionDO> | The list of constraint rule action applied to the cart. |
HasPendingError | Boolean | Indicates whether there are pending rule actions that are error type. |
HasPendingWarning | Boolean | Indicates whether there are pending rule actions that are warning type. |
NeedMoreProcessing | Boolean | Indicates whether the rule required more processing. |
Response Data Object - Apttus_CPQApi.CPQ.AppliedActionDO | ||
---|---|---|
Field | Type | Description |
ActionIntent | String | The action intent of the applied constraint rule. |
ActionType | String | The action type of the applied constraint rule. |
AffectedPrimaryNumbers | List | The primary line number of the line item the constraint rule is applied on. |
AffectedProductIds | List | IDs of the line item the constraint rule is applied on. |
AppliedActionId | ID | The ID of the constraint rule action applied on the cart. |
AppliedRuleInfoId | ID | The Applied Rule Info ID of the constraint rule action |
CartId | ID | The ID of the cart. |
ConstraintRuleActionId | ID | The ID of the constraint rule action. |
CriteriaFields | List | The criteria fields in the constraint rule action. |
IsAutoExecuted | Boolean | Indicates whether the auto-execution is enabled for the constraint rule. |
IsHideMessage | Boolean | Indicates whether the messages are hidden. |
IsIgnoredByUser | Boolean | Indicates whether ignoring the constraint rule is allowed. |
IsPending | Boolean | Indicates whether any action is pending from the user to execute the constraint rule. |
IsShowPrompt | Boolean | Indicates whether prompt is required. |
IsTargetOptionProduct | Boolean | Indicates whether the target include or exclude products should be present in the shopping cart as options. |
IsTargetPrimaryProduct | Boolean | Indicates whether the include or exclude products should be present in the shopping cart as primary lines. |
MatchCountRule | String | |
Message | String | The message added to the constraint rule action. |
MessageType | String | The type of the message defined in the constraint rule action. |
SuggestedProductIds | List | The IDs of the product suggested by rule action definition to be included in the cart. |
TargetBundleNumber | Integer | The 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. |
TriggeringPrimaryNumbers | List | The primary numbers of the line items that have triggered the rule action. |
TriggeringProductIds | List | The 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