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
Rajeshwar PatelRajeshwar Patel 

Lightning component for Account list

Hi all,
 I need to write :- Account list lightning component to display all Accounts where the running user is listed as PDCM(Which is basically a role -) in the custom sharing team record(custom_sharing_team__c) .

i created the .cmp , .js , .css . But i ned to create a contrller class .where i need to put my logic . Can any one please help me for the logic 

public class AccountListController {
  @auraEnabled
    public static list<account> getAllAccounts()
    {
        //Code Here 
    }
}
Chris Gary CloudPerformerChris Gary CloudPerformer
Is custom_sharing_team__c a lookup field on the Account Record to a user? If so, then you should be able to do the following:
public class AccountListController {
  @auraEnabled
    public static list<account> getAllAccounts()
    {
        return [SELECT Id, Name FROM Account WHERE custom_sharing_team__c = :UserInfo.getUserId()];
    }
}
If 'custom_sharing_team__c' is an object or a reference to another join object, then I need to understand your data-model better to help you.