When to use the typeof clause in soql?

When to use the typeof clause in soql?

TYPEOF is an optional clause that can be used in a SELECT statement of a SOQL query when you’re querying data that contains polymorphic relationships. A TYPEOF expression specifies a set of fields to select that depend on the runtime type of the polymorphic reference. TYPEOF is available in API version 46.0 and later.

Is the typeof feature available in Salesforce.com?

TYPEOF is currently available as a Developer Preview as part of the SOQL Polymorphism feature. For more information on enabling TYPEOF for your organization, contact salesforce.com.

When to use typeof in a polymorphic query?

TYPEOF is only allowed in the SELECT clause of a query. You can filter on the object type of a polymorphic relationship using the Type qualifier in a WHERE clause, see Filtering on Polymorphic Relationship Fields for more details.

How is a polymorphic relationship checked in SOSL?

When the SELECT statement runs, each object type associated with the polymorphic relationship field specified in the typeOfField expression is checked for a matching object type in a WHEN clause. A list of one or more fields, separated by commas, that you want to retrieve from the specified whenObjectType.

What happens when you add limit clause in soql?

Note that only the most efficient plan is used, so while there is a curious third plan evaluated when you add the LIMIT clause, it does not effect run-time performance of the query. Not the answer you’re looking for? Browse other questions tagged soql query governorlimits performance or ask your own question.

How many characters is the where clause in soql?

While the TOTAL length of a SOQL query must be less than 20,000 characters, the WHERE clause can only be 4,000 characters. And the IN clause is part of that 4,000 characters.

Do you need to reference profile in soql?

One small aside note about the query, you don’t need the “, user.profile” in the from clause. SOQL will do the reference join for you without it. So to get to the Profile name element you will need to traverse via the Profile XmlElement. How you do that will depend on your language. Thanks for contributing an answer to Salesforce Stack Exchange!