Giter Club home page Giter Club logo

Comments (7)

HenryRLee avatar HenryRLee commented on August 16, 2024

Hi, I think you could select Owner.Name instead of Owner.FirstName. Because OwnerId is a polymorphic lookup, which can be a user Id or a group Id. So I guess you cannot select FirstName in this case.

from query.apex.

vsmarimuthu avatar vsmarimuthu commented on August 16, 2024

Actually when I write like this , I am not getting any Issues.

List oCase=[select Id,CaseNumber,ReceivedDate__c,CreatedDate,Owner.FirstName,Owner.Lastname,Origin from Case];

So do we have to follow the Owner.Name only as per your suggestion?

from query.apex.

HenryRLee avatar HenryRLee commented on August 16, 2024

I see the issue you're facing. I just did an update to fix this issue. You may pull the latest code and try again.

from query.apex.

aranwe avatar aranwe commented on August 16, 2024

from query.apex.

HenryRLee avatar HenryRLee commented on August 16, 2024

Hi @aranwe
In the very early implementation, we enforced field-level security, by traversing all the fields selected, including the fields from the parent object. In order to traverse the fields in the parent object, we had to get the object type of the parent object. If the parent field is a polymorphic lookup, I just randomly chose one, assuming that we could only select the common fields of the polymorphic object types. But when this issue was raised, I realized that assumption wasn't always true (FirstName is not a common field but it can be selected in native SOQL).

Since APEX version 48, we can use the WITH SECURITY_ENFORCED to enforce security checks, instead of traversing all the fields. Therefore I just replaced all the security checking codes with the new WITH SECURITY_ENFORCED keyword. You may find it in this commit f5b2b7c.

from query.apex.

aranwe avatar aranwe commented on August 16, 2024

from query.apex.

vsmarimuthu avatar vsmarimuthu commented on August 16, 2024

@HenryRLee
Things are looking good now.
Thanks for your support.

from query.apex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.