0

So, as the title says, I would like to find all the records of an object that have been created by OR are only visible by a certain profile.

Here is a query I have tried

SELECT Id, Subject, CreatedDate FROM Event Where CreatedDate > 2020-03-02T12:00:00Z AND Profile.Name='ProfileName'

But this seems like it can only be done if you are SELECTing from the User object

Any Ideas?

1 Answer 1

2

That's because the field called 'Profile' only exists on the User object. Try

SELECT Id, Subject, CreatedDate FROM Event Where CreatedDate > 2020-03-02T12:00:00Z AND CreatedBy.Profile.Name='ProfileName'

That's sorts out your "created by" need. Question of "visible" by certain profiles is different. SOQL query won't tell you that - not for a Profile. Profile gives users access to View data in a certain Object, but that does not mean that they will see any Records - this will depend on Ownership and Sharing. Can you add more detail about what you mean by "visible"?

1
  • You basically answered my question the best way possible, this is exactly what I was looking for. And by "visible" I basically was meaning like, Marketing isn't going to see Warehouse profiles. It was bad context sorry about that. Thanks boss.
    – CodyB
    Commented Mar 6, 2020 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .