2

I am having simple custom object(Resources) with out any relation ship and having only one field (Resource Name)

I am trying to access the data inside this custom object through APEX and the user is guest user license.

Here is the list of settings I enabled so that guest user license profile can access the record

  1. Went to the Guest user license profile and enbaled FLS to all the fields in the object enter image description here

2)Went to custom object permission and enabled create and read access enter image description here

3)Went to sharing settings and enabled Public Read/Write to default external access enter image description here

But still also not able to get records from this object but I have one record and here is the debug log enter image description here

3:38:14.2 (7972335)|SOQL_EXECUTE_BEGIN|[19]|Aggregations:0|SELECT ResourceName__c FROM Resources__c
23:38:14.2 (40024754)|SOQL_EXECUTE_END|[19]|Rows:0

and My simple APEX code is

    @AuraEnabled(cacheable=false)
    public static  List<Resources__c> searchDoctor(String searchStrng){    
        List<Resources__c> lstServiceResource= [SELECT ResourceName__c from Resources__c ];
            return lstServiceResource;
    }

PS:Enabled APEX class access for this Guest user profile also.

I am clueless on which setting still I have to enable . Need help on this.

1 Answer 1

2

Got the answer. This link helped me and to be precise I created one dummy sharing rule for that custom object and shared to guest user as like the screen shot below enter image description here

3
  • Glad you found a solution. Could you please enhance the answer with necessary detail so it isn't essentially just a link since these get broken over time and your answer will become useless to others if that happens here.
    – Phil W
    Commented Jul 21, 2022 at 6:19
  • Sure @PhilW. Thanks
    – SFDC buddy
    Commented Jul 21, 2022 at 6:22
  • 3
    The 'dummy' sharing rule can be easily done as Id != blank
    – Matt Lacey
    Commented Feb 16, 2023 at 9:28

You must log in to answer this question.

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