Happy Business Starts Here

Savvy Scholar

Missing records in 'query' operation


I'm trying to find  the RatePlan associated with the RatePlanCharge using the 'query' operationHere's some screenshots from Postman:

First query: 

	"queryString": "SELECT RatePlanId From RatePlanCharge Where Id='2c92c0f866a9a8fe0166bdafda02450d'"

Screenshot from 2018-10-29 11-12-08.png

Next quering the the RatePlan with above Id:

	"queryString": "SELECT Id From RatePlan Where Id='2c92c0f866a9a8fe0166bdafda02450c'"

Screenshot from 2018-10-29 11-11-44.pngAny idea why it's returning no records? I can see the record when using Batch Query(https://rest.apisandbox.zuora.com/v1/batch-query/)

Support SME

Re: Missing records in 'query' operation

I am afraid it is caused by a known limitation of ZOQL.

When query RatePlan data, it is suggested to use the ZOQLExport as it is more powerful. Export ZOQL queries can select data from related business objects in a single operation. If you still would like to use ZOQL, you may add an 'and AmendmentType!=null' condition in the query which looks like:

select id from RatePlan where id = '2c92a0ff62045846016204ad8cd04660' and AmendmentType!=null

ZOQL and Export ZOQL are handled by the different processors when querying data. ZOQL is introduced firstly and later Export ZOQL which is more powerful than ZOQL. For ZOQL, we add a condition "amendment type cannot be RemoveProduct" when querying RatePlan data. We need it in order to keep the same behavior as UI display. ZOQL and UI share the same processor. In UI, RatePlan which has been removed need to be hidden. Please note that the ZOQL logic is not updated recently.

Reference: https://knowledgecenter.zuora.com/DC_Developers/M_Export_ZOQL