You need to sign in to do that
Don't have an account?

no viable alternative at character '%'
Hi,
I'm facing problem having subquery.
Here is my query:
---------
QueryResult query = binding.query("select Title, "
+ " from ContentVersion v where "
+ "v.ContentDocumentId = '(select id from contentdocument c where c.latestpublishedversionid like \'<somevalue>%\')'");
----------
I tried couple other approaches to escape '%' but, no luck.
no viable alternative at character '%' is the error I see on execution.
Did I miss anything?
Thanks,
Suresh
Print the query in system debug and see what comes and let know the query which is coming.
Thanks
Hi Souvik,
Thanks for the pointers.
Not sure, If I'm missing something here but, let me briefly explain what I'm doing...
1/ My client application is using API from 'exterprise.wsdl' generated classes
2/ In my java program I'm using these APIs to login and download content from salesforce site
I have access to web portal only. I do not have access to backend server or salesforce logs.
I tried debugging my client flow but, no luck (as something is failing on server side).
Is there a way to look at logs/debug messages using API?
Thanks,
Suresh
SOQL supports the LIKE operator for string fields only. You cannot use LIKE '000%' with Id fields. See the documentation here:
http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_select_comparisonoperators.htm
Please mark this as resolved.
Steve
Steve,
'latestpublishedversionid' is varchar field.
And the query I'm trying is working fine from SQL shell
------------
select Title, "
+ " from ContentVersion v where "
+ "v.ContentDocumentId = '(select id from contentdocument c where c.latestpublishedversionid like \'<somevalue>%\')';
--------------
As per the document link shared, the query tried by me should be well formed.
Thanks,
Suresh
When I look at the metadata for the ContentDocument.LatestPublishedVersionId field in Workbench, I see that the field type is "reference", which indicates to me that it is an Id field.
Any solution you found for the issue your reported? Thanks in Adv
Satish