0

I'm tracking down a bug that fails on this query because it returns no rows. The user I'm using is relatively new and still working out the kinks:

UserAppInfo userApp = [SELECT Id, AppDefinitionId
                       FROM UserAppInfo 
                       WHERE UserId = :Userinfo.getUserid() LIMIT 1];

When queried from workbench with no WHERE clause, I can see a handful of rows with different UserIds. Mostly Sys Admins I think.

I'm not sure what my question is exactly, but I need a UserAppInfo record returned with my new User/Profile/Permission Set configuration. Any ideas on how to achieve this?

5
  • 1
    Has the user logged-in and accessed a lightning-app? UserAppInfo stores the last Lightning app logged in to.
    – Rohit
    Mar 27, 2023 at 13:30
  • I guess yes. . . It happens in a Liginting app - @Rohit - I'm going to the user record and clicking login button. Do I actually need to login as the user?
    – mackmama
    Mar 27, 2023 at 13:59
  • 1
    Yes, you can login in any way and just navigate to a app like Sales in LEX. Then UserAppInfo record should be visible for that user.
    – Rohit
    Mar 27, 2023 at 14:04
  • Never have seen this one before. That worked @Rohit - ty!
    – mackmama
    Mar 27, 2023 at 14:07
  • Great! You can add that as answer for future reference.
    – Rohit
    Mar 27, 2023 at 14:11

1 Answer 1

2

@Rohit helped me resolve this one. As the logged-in user, you must open the Lightning App that you're working in. So, where I was getting hung up, was when I clicked into the User and logged in as the user, I needed to open the app explicitly, ie. go to the top left of the page, click on the 9 dot box, and open the app there.

You must log in to answer this question.

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