function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SalesforceLearnerSalesforceLearner 

Lightning component to display login partner user Accounts

How to display the currently logged in partner user accounts on Lightning component ?

I am using below code but it is not working 

public class AccountInformation {
   @AuraEnabled
   public static List<Account> getAcc() {
       
        ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;

        ID AccID  = [Select AccountID from Contact where id =: contactid ].AccountId;
      
      return [SELECT Id, name, Industry FROM Account where Id =: AccID ];
   }   
}
James LoghryJames Loghry
How is this not working?  Are you getting an exception when callin the method? Is it returning an empty list of accounts?  Is the accountId getting populated correctly?  Is the contactId getting populated correctly?  It would be more prudent for everyone's sake if you did SOME debugging before coming here asking for help.  Details are appreciated, and we can use those details for assiting you in the future.

Also, when you post any sort of code, formula, VF or lightning markup, please utilize the code format button (< >).  Thank you.