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
RupaliJRupaliJ 

How to access allowed profiles list of Organisation wide email addresses using apex

Hi,

 

I want to access allowed profiles of Organisation wide email addresses. I am able to access is that email address is allowed to all profiles or not. Can anyone please suggest me some solution to achieve 'Allowed profiles' details.

 

Thanks.

UVUV

What do you mean by Allowed profiles?

If you want to access Email Address Field of all profiles then you can query Profile Object.

I am not sure what you are asking for.Pls repost your question.

RupaliJRupaliJ

Hi Umesh,

 

Actually I am building custom visual force page for 'Send an Email' in Activity History. I want to show organisation wide email addresses in 'From' dropdown of Sender's email addresses. Can you please suggest me some solution to show Organisation wide email addresses which are allowed for that particular logged in user's profile?

 

Thanks,

Rupali.

UVUV

orgWideEmailAddress is std object and I guess you can use that to query to get the Address selected for perticular profile.

RupaliJRupaliJ

Umesh, I am able to access all orgwideEmailAddress. But now I want to access only those email addresses that are allowed to logged in user's profile.

For example, if there are 10 org wide email addresses and only 5 are allowed for 'System Administrator', then I want to show only those 5 email addresses in 'From' dropdown of sender.

 

Thanks,

Rupali

dipsdips

Umesh,

 

There is no field for extracting emails from standard Profiles object..

How can i get list of emails for required profiles?

 

 

UVUV

Get the profile Id from the profile object and search the profile Id in User object. If matched get the Email of the User..

In the way you can get All Email Addresses.I guess this is what you are asking for.

 

dipsdips

ok, but these will give me email addresses of users from the org

 

But case here is:

 

If your organization requires users to share a common email alias, you can define a list of organization-wide addresses for each user profile. Organization-wide addresses define a common email address that a user profile can use. When sending email from Salesforce, users with these profiles can choose a different From address than the email address they have defined. Replies are delivered to the organization-wide address.

 

So i am querying OrgWideEmailAddress object to get details for records,

But this object have only following fields: Address, IsAllowAllProfiles, DisplayName

Not finding way to get list of profiles if IsAllowAllProfiles=false

RKBRKB

 Hi,

 

Did you find any solution?  I have the same requirement and the issue.

 

Thanks in advance,

Ravi

Farhat MirzaFarhat Mirza
Any luck guys ? I have the same requirement.
SupernitramSupernitram
Have you found any solution guys, I've got exactly this problem, I want to give access to 20 OWE to 30 different profiles but only them and ti woudl be great to do it thanks to data loader...as they are even not sorted alphabetically
Robert NordmanRobert Nordman
Any solutions in the last 7 years?  Trying to solve the same requirement.
Ken Koellner @ EngagewareKen Koellner @ Engageware

It seems like somewhere in SF there has to be a many-to-many connection between OrgWideEmailAddress and Profile.  So the question is whether that relationship is in a visibile object.  I haven't found it.  And I surmise that the origin of this thread is that the original poster couldn't find it either.  Is suspect the data is hidden but if anyone can offer insight, that would be great.

The reason I was looking is I need to give access to an Org-Wide Address to a Site Guest User.  The only way I can figure out how to do that is via the All Profiles option.  The Site Guest User Profile is not offered in the selection.  I thought maybe if I could find the Profile access represented in an object, I could just insert a record.  But I suspect the object is invisible and there is no way to accomplish that.

Jimmy Li 2Jimmy Li 2
For someone facing the same problem, if the Org-Wide address has the "Allow All Profiles to Use this From Address" checkbox checked, then all profiles are granted.

If not, then here's an object for the allowed profiles per org-wide email address: OrgEmailAddressSecurity

Run SOQL: SELECT Id, ParentId, OrgWideEmailAddressId, SystemModstamp FROM OrgEmailAddressSecurity

** The ParentId is the Permisison Set ID belongs to the profile.

And in the Summer '23 release, Salesforce announced a new feature to manage the org-wide address by using Permission Set.
You can find the details here: https://help.salesforce.com/s/articleView?id=release-notes.rn_sales_productivity_email_owea_permission_sets.htm&release=244&type=5