I have the following code:
prodList = [SELECT ServicePartner__r.Name, ServicePartner__r.BillingAddress, ServicePartner__r.BillingStreet
FROM Product2
WHERE id = :productId AND IsActive = true
LIMIT 10];
Address adr = prodList[0].ServicePartner__r.BillingAddress;
System.debug('Address str ' + (adr != null? adr.getStreet(): 'null'));
System.debug('BillingStreet ' + prodList[0].ServicePartner__r.BillingStreet);
System.debug('Name ' + prodList[0].ServicePartner__r.Name);
- If I run it logged in, the log shows everything right:
08:39:06:017 USER_DEBUG [29]|DEBUG|Address str San Miguel 1
08:39:06:045 USER_DEBUG [27]|DEBUG|BillingStreet San Miguel 1
08:39:06:045 USER_DEBUG [28]|DEBUG|Name Test Community
- If I run it with the Guest User, the log shows null for the address but not for the Account name:
09:00:55:137 USER_DEBUG [29]|DEBUG|Address str null
09:00:55:137 USER_DEBUG [30]|DEBUG|BillingStreet null
09:00:55:137 USER_DEBUG [31]|DEBUG|Name Test Community
He have set permission to the guest profile for the account object and for the BillingAddress field as shown bellow:
Do you know what else needs to be done?
Thank you