Illuminated cloud not supporting TYPEOF SOQL queries properly
When defining a so called polymorphic SOQL query in a usual Apex class, Illuminated Cloud shows a syntax error with
',' expected, got 'WHEN'
Sample query:
SELECT Id, TYPEOF Owner
WHEN User THEN UserType
END,
CreatedBy.UserType
FROM Lead
The error only shows up in the IDE, the Apex class can be saved to the target org successfully anyway.
See https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_typeof.htm for a description of the TYPEOF syntax.
Comments (10)
-
repo owner -
When this bug will be fixed?
-
repo owner Wow...I think this just got lost in the shuffle as it wasn't on my radar. Thanks for bumping it back into visibility. I'll take a look shortly.
-
I am also encountering this bug. Just bumping it for visibility again.
-
repo owner Okay, I'm committing the fixes for this now for inclusion in the next build (perhaps tomorrow but likely Friday due to TDX20):
So sorry this has languished for so long!
-
repo owner - changed status to resolved
Delivered in 2.1.2.7. Please make sure that your OST is properly generated as the code completion features include here depend on the OST's polymorphic field information.
-
One last issue with TYPEOF in SOQL - version 2.1.4.5
The line
ELSE Name
hasName
highlit in Red with inspector error: “unresolvable reference”. This compiles and executes just fine.CaseTeamMember[] ctms = [SELECT Id, Parent.CaseNumber, TYPEOF Member WHEN User THEN Name,IsActive ELSE Name END FROM CaseTeamMember];
-
repo owner Thanks for letting me know, Eric. Should be simple enough to address--certainly relative to the last pass! I'll take a look for one of the near-term releases.
-
repo owner This is now fixed for inclusion in the next build, both references and code completions for fields in
TYPEOF ELSE
clauses. -
repo owner Additional fixes delivered in 2.1.4.8.
- Log in to comment
Thanks for filing, Michael. Should be a pretty simple grammar fix. I'll see about including it in a near-term build.