Happy Business Starts Here

Zuora Support Moderator

Querying for RatePlan object isn't showing removed amendments

Question: When I query the RatePlan object using the SOAP API, I seem to be missing some of my subscription rate plan charges. They seem to be the charges that have been removed via an amendment at some point. When I use zoql/data exports, I am getting the expected results. Why is this happening?

 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Highlighted
Zuora Support Moderator

Re: Querying for RatePlan object isn't showing removed amendments

Response: 

Although SOAP and zoql can return similar results, there are some cases where the results differ. The RatePlan object is one of them.

By default, rate plans that were removed by an amendment with the type, Remove Product Amendment, aren't returned by queries.
If you want to return rate plans that were removed by an amendment, add AmendmentType != null in the where clause conditions.

Here are some example scenarios.

This query will not return anything:

 

<ns1:query>
<ns1:queryString>Select Id, AmendmentId, AmendmentSubscriptionRatePlanId, AmendmentType, CreatedById, CreatedDate, Name, ProductRatePlanId, SubscriptionId, UpdatedById, UpdatedDate From RatePlan Where Id='2c92a0fa4f4fe012014f6170f7b2azf1'</ns1:queryString>
</ns1:query>

 

 

This query will provide the expected response:

 

<ns1:query>58
<ns1:queryString>Select Id, AmendmentId, AmendmentSubscriptionRatePlanId, AmendmentType, CreatedById, CreatedDate, Name, ProductRatePlanId, SubscriptionId, UpdatedById, UpdatedDate From RatePlan Where AmendmentType != null and Id='2c92a0fa4f4fe012014f6170f7b2azf1'</ns1:queryString>
</ns1:query>

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns1:queryResponse xmlns:ns1="http://api.zuora.com/">
<ns1:result>
<ns1:done>true</ns1:done>
<ns1:queryLocator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1"></ns1:queryLocator>
<ns1:records xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RatePlan">
<ns2:Id>2c92a0fa4f4fe012014f6170f7b2azf1 </ns2:Id>
<ns2:AmendmentId>2c92a0f94f4fcffb014f61709226917a</ns2:AmendmentId>
<ns2:AmendmentSubscriptionRatePlanId>2c92a0f94cc0a203014cc2b3dd07p01z</ns2:AmendmentSubscriptionRatePlanId>
<ns2:AmendmentType>RemoveProduct</ns2:AmendmentType>
<ns2:CreatedById>2c92a0fb415dd8e50141be0355976it1</ns2:CreatedById>
<ns2:CreatedDate>2016-02-09T13:40:37.000-07:00</ns2:CreatedDate>
<ns2:Name>Monthly Charge</ns2:Name>
<ns2:ProductRatePlanId>2c92a0fb42ea9dbf0142ec1d662e172d</ns2:ProductRatePlanId>
<ns2:SubscriptionId>2c92a0f94f4fcffb014f61711b011t8a</ns2:SubscriptionId>
<ns2:UpdatedById>2c92a0fb415dd8e50141be0355976it1</ns2:UpdatedById>
<ns2:UpdatedDate>2016-02-10T13:40:46.000-07:00</ns2:UpdatedDate>
</ns1:records>
<ns1:size>1</ns1:size>
</ns1:result>
</ns1:queryResponse>
</soapenv:Body>
</soapenv:Envelope>

Reference:
RatePlan SOAP API Object

 



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √