This API fetches price agreements based on proposals or agreements.

API Details

APISignature
GetPriceAgreementswebService static CPQApiStruct.GetPriceAgreementsResponseDOGetPriceAgreements(CPQApiStruct.GetPriceAgreementsRequestDO)

Parameters

Name

Type

Description

request

CPQApiStruct.GetPriceAgreementsRequestDO

     The request data object.


Request Data Object - CPQApiStruct.GetPriceAgreementsRequestDO

Field

Type

Required?

Description

PriceAgreementType

String

Yes

The type of price agreement. Valid Values: Proposal, Agreement.

Criteria

CPQApiStruct.FilterDo

No

The criteria details like API agreement name and proposal. This is based on FilterDo object.

Fields

List<String>

No

The list of fields to be displayed in the response data object based on the price agreement type.

AccountIds

List<Id>

No

The account IDs passed to fetch the price agreements. This field narrows down the price agreements based on the filter of account IDs.  


CPQApiStruct.FilterDO

This is an API object that feeds to criteria variable of below request objects:

  • CPQApiStruct.GetPriceAgreementsRequestDO
  • GetPriceAgreements CPQApiStruct.GetPriceAgreementItemsRequestDO

Request Data Object - CPQApiStruct.FilterDO

Field

Type

Required?

Description

SObjectName

String

Y

API name of the subject valid values are: Apttus_Proposal__Proposal__c, Apttus__APTS_Agreement__c

Predicates

List<CPQApiStruct.PredicateDO>

Y

 List of conditions in where clause

ConditionExpr

String

N

To define the complex logic among multiple conditions.

Example for 2 conditions (1 OR 2)


CPQApiStruct.PredicateDO

This API defines a filter based on which criteria specifications are set. List of this needs to feed Predicates variable of FilterDO object type variable.

Parameters

Name

Type

Description

request

CPQApiStruct. PredicateDO

     The request data object.

Request Data Object - CPQApiStruct.PredicateDO

Field

Type

Required?

Description

RowNum

Integer

Y

The row numbers.

FieldName

String

Y

The API name of the field.

CompOper

String

Y

The type of query comparator. Valid values:

equal to,

not equal to,

less than,

less than or equal to,

greater than,

greater than or equal to,

in,

not in,

like,

not like,

includes,

excludes,

starts with,

ends with,

contains,

does not contain.

FieldValue

String

Y

The value based on which data should be fetched.

API Response

Response Data Object - CPQApiStruct.GetPriceAgreementsResponseDO

Field

Type

Description

PriceAgreements

List<sObject>

The list of price agreements fetched based on the specified input fields.


Code Sample

The following sample enables you to create an order for a valid account with an Account Id and a Price List with a valid Price List Id. Using the sample below, you can search for a valid account using an account number. If an account exists with the account number entered, you can create an order using the createorder() API. You can invoke this API in use cases when you want to create an order page based on the account and price list. 

Apttus_Config2.CPQApiStruct.GetPriceAgreementsRequestDO request = new Apttus_Config2.CPQApiStruct.GetPriceAgreementsRequestDO();

// possible values Proposal,Agreement
request.PriceAgreementType = 'Proposal';

Apttus_Config2.CPQApiStruct.FilterDO criteriaSpec = new Apttus_Config2.CPQApiStruct.FilterDO();

// Proposal,Agreement sobjectApi name
criteriaSpec.SObjectName = 'Apttus_Proposal__Proposal__c';

// setup predicates
Apttus_Config2.CPQApiStruct.PredicateDO predicate = new Apttus_Config2.CPQApiStruct.PredicateDO();
predicate.RowNum = 1;
predicate.FieldName = 'Name';
predicate.CompOper = '=';
predicate.FieldValue = 'Q-11122';
criteriaSpec.Predicates.add(predicate);
request.Criteria = criteriaSpec;

List<String> fieldNames = new List<String>{'Id','Name'};
request.Fields.addAll(fieldNames);


List<Id> accIds = new List<Id>();
accIds.add('0015000000Fn6m0');

request.AccountIds.addAll(accIds);
 
//select Id, Name From Apttus_Proposal__Proposal__c Where Apttus_Proposal__Approval_Stage__c =:Accepted
 
Apttus_CPQApi.PriceAgreementApiCallback apiCall = new Apttus_CPQApi.PriceAgreementApiCallback();
Apttus_Config2.CPQApiStruct.GetPriceAgreementsResponseDO result = apiCall.getPriceAgreements(request);
List<SObject> PriceAgreements = new List<SObject>();

if (!result.PriceAgreements.isEmpty())
PriceAgreements = result.PriceAgreements;
system.debug(PriceAgreements);
CODE