function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SreechuSreechu 

Problem with SOQL Filtering 'like' when using Tooling-API

I am trying to use Tooling-API and query all Classes using this string: 

String soqlQuery = SELECT+Coverage,ApexClassorTrigger.name,ApexClassorTriggerId+FROM+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+=+\'01pf0000000DHYYAA4\' 

This works fine and loads the particular class, BUT if I try :

String soqlQuery =
SELECT+Coverage,ApexClassorTrigger.name,ApexClassorTriggerId+FROM+ApexCodeCoverageAggregate+where+ApexClassorTriggerId+=+\'01p%\'

I get this error on page: " Malformed JSON: Expected '{' at the beginning of object "
Can anyone tell what is wrong ? or is it that LIKE clause cannot be used while constructing a Query ?

(This is later passed to : HTTPRequestInstance.setEndpoint(URL + soqlQuery); )
 

Ashish_SFDCAshish_SFDC
Hi , 


% will replace only 1 character, try using 15 %s and re try which may solve the problem. 

I would suggest you use a list rather than storing a single object record. 


Regards,
Ashish


RitikaBhrgvRitikaBhrgv
Hi Sreechu,

I think by now you would have found probable solution, but mentioning a similar post for others reference here:

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yBcIAI