1
[select FederationIdentifier from user limit 15]

The above query works perfectly fine on user object workbench and developer console but when I write below query to pull list of cases along with user federation Id, I am getting "Error: No such column 'FederationIdentifier' on entity Name"

List<case> c = [select Id, ownerId, owner.name, owner.FederationIdentifier from case limit 15]

Can anyone suggest me where I am going wrong.

Referred Question # 47467 here which says owner.FederationIdentifier fails. So, is there any workaround for this ?

Thanks

2

This is the result of limitations when working with polymorphic fields (Case.Owner, Event.Owner, Etc.).

Basically, salesforce doesn't have enough context in SOQL to know which object to pull from since you might have a Case assigned to a Queue or a User.

My only known workaround is to create a custom formula field on Case called Owner.FederationId__c and reference this in your SOQL.

Use this as your formula (note the additional notation of User which provides object context for salesforce):

Owner:User.FederationIdentifier

I am aware you can request a feature to allow polymoprhism in your SOQL Queries. Here's some documentation on it:

https://developer.salesforce.com/blogs/tech-pubs/2012/09/soql-polymorphism-or-how-i-learned-to-love-the-polymorphic-relationship.html

2
  • Thanks James.. I tried to create a formula field on case.. Case > caseOwner(User) > 'Here I dont see FederationId..'. I checked for "Federation Identifier in $user as well but unable to find. – sf_user Aug 5 '15 at 14:57
  • Man, that's a huge drawback... sorry for not realizing it. This may be a workaround to the proposed workaround: salesforce.stackexchange.com/questions/83750/… – James Aug 5 '15 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.