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
philbophilbo 

Using LIKE clause against RecordType SobjectType field

Hey,

The following SOQL query:

select Name , SobjectType from RecordType where SobjectType like 'whatever%'

throws an 'INVALID_QUERY_FILTER_OPERATOR' error:  'invalid operator on id field'.

The 'like' clause works fine on other RecordType fields (e.g. Name), and on picklists on other objects (e.g. User.Salutation).
 
Was wondering what's special about this particular field (RecordType.SobjectType), and if anybody knows of a workaround, aside from the obvious - select all records and filter the output with a regexp '^whatever.*'

Thanks!
awilawil
I got this error too. I think it's a little cryptic because it seems to say that the subject of your WHERE clause (sObjectType) is an Id, but it's not. However, I think that the LIKE operator is usually used against fields of String type, whereas in this case the sObjectType is a field of type picklist. Maybe it's not acceptable to use the LIKE operator against a picklist field (although it would definitely be useful to do so).

[more searching...]

This is an old post, but "DevAngel" confirms that (at least at one point) LIKE is not available for picklist fields: http://community.salesforce.com/sforce/board/message?board.id=general_development&thread.id=698&view=by_date_ascending&page=2