tsalb/lwc-utils

SOQL Datatable - query/filter for records owned by current user

solo-1234 opened this issue · 7 comments

I'd like to configure a datatable (on flexipage) so that it shows each user a list of their records - either via record owner, or via a custom User lookup field. I don't see a way to do that currently.

(Current use case is showing sales reps a dynamic list of calls to make.)

Temporary workaround: create a boolean formula field on the object that compares the running user to the lookup field and filter on that.

Thanks!

tsalb commented

I believe I have access to userId via some import in LWC (double check later)

Additionally, I think this would align to $CurrentRecord API and just use the special string $CurrentUserId

tsalb commented

Adding some cool context we figured out over the discord.

For this, I'd like to strongly align to what can be leveraged via LDS (read: don't use a custom apex class to back anything related to the UserInfo class).

The rationale here is I want to let this framework grow in alignment with LDS (which has some magic built in) and the net benefits of bringing the UserInfo class via custom class is, IMO, not worth the investment.

@tsalb curious on your last comment (since the PR for this uses no Apex class); while LDS isn’t explicitly employed, I suspect the built-in I used leverages it under the hood

tsalb commented

@jamessimone oops yes, I haven't checked your PR and that comment was not directed at you (otherwise, it would be on the PR).

That was more additional context when psb and my convo on discord reached that conclusion. It was meant for future readers =D

cheers to posterity!

tsalb commented

Closing this, but package has not been made yet.

Keep an eye on the next version when I get to that piece!

Sounds good - thanks for reviewing!