Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyRecords() func assumes object has 'ownerId' column #128

Closed
perbrondum opened this issue Jun 6, 2021 · 8 comments
Closed

MyRecords() func assumes object has 'ownerId' column #128

perbrondum opened this issue Jun 6, 2021 · 8 comments
Assignees

Comments

@perbrondum
Copy link

If the new MyRecords is to be used across objects it should not use 'ownerid' in predicate.

@mike4aday
Copy link
Owner

mike4aday commented Jun 6, 2021

Hi @perbrondum not sure I understand your objection. myRecords is meant to be a convenience method: callers don't have to know the logged-in user's ID, and the OwnerId field is present on most objects. If myRecords were to be called with a type that doesn't have an OwnerId field, the publisher will fail with an error. In such cases, it's always possible to write a custom SOQL query for a particular object using the query method instead.

@mike4aday mike4aday self-assigned this Jun 6, 2021
@mike4aday
Copy link
Owner

@perbrondum I'll add a note to the documentation so it's more explicit that the type argument has to be for an SObject type that does have the ownerId field.

@perbrondum
Copy link
Author

perbrondum commented Jun 7, 2021 via email

@mike4aday
Copy link
Owner

@perbrondum Cases and Accounts, for example, are routinely reassigned after creation and then would have CreatedById != OwnerId no?

@perbrondum
Copy link
Author

perbrondum commented Jun 7, 2021 via email

@mike4aday
Copy link
Owner

@perbrondum I don't understand - if I'm interested in querying records I own, e.g. cases or accounts for which I'm responsible, and regardless of who or what process originally created the records, then querying for records where my user ID equals the records' CreatedById wouldn't work, no?

@perbrondum
Copy link
Author

perbrondum commented Jun 7, 2021 via email

@mike4aday
Copy link
Owner

@perbrondum thanks. I added a note to the documentation that the method is for types with OwnerId field and reference to docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants