Skip to main content
Free Agentforce workshops and AI Certifications: Learn more. Terms and conditions apply.

Share Data Using an Account Relationship

Follow Along with Trail Together

Want to follow along with an expert as you work through this step? Take a look at this video, part of the Trail Together series.

(This clip starts at the 53:35 minute mark, in case you want to rewind and watch the beginning of the step again.)

Create Account-to-Account Business Relationships

Maria isn’t done setting up the business process needs for Ursa Major partners. She realizes that she needs more granular control over what information she’s sharing between partner accounts, and she decides to use Account Relationships to meet her business needs.

When to Use Account Relationships

Account relationships are great when you need to set up a business relationship between two of your partner accounts. Let’s say that you have a distributor who needs access to a subset of the customer accounts owned by his reseller so that he can effectively support them. Or you have a distributor who needs to collaborate with a reseller on specific deals.

Or maybe you were thinking of using Apex sharing for account-to-account sharing.

These examples are perfect for the Account Relationship feature.

Check Opportunity Data Visibility

Maria’s use case comes directly from Ursa Major’s channel account manager, Maya Pasqua. Maya wants Express Logistics and Transport partner users to see all the opportunities associated with the Pyramid Construction reseller account.

Before we solve for this use case, let’s do some groundwork to make sure that Pyramid Construction opportunities aren’t already visible to Express Logistics and Transport partner users.

To do that, we have to convert the Pyramid Construction account into a partner account and change the owner of the Pyramid Construction opportunity to a partner user on the account.

  1. From the App Launcher, select Accounts.
  2. Select the All Accounts list view.
  3. Click Pyramid Construction.
  4. Click the dropdown menu to see all the quick actions available for the page.
  5. Click Enable as Partner.
  6. In the confirmation dialog, select Enable As Partner.
  7. Click Pat Stumuller from the contact related list.
  8. From the dropdown menu, select Enable Partner User.
  9. Change the following in the New User detail page.
    • Email: [Enter your email address so you can get login information for your newly created users.]
    • Username: [unique username in an email format]
    • User License: Partner Community
    • Profile: Partner Community User 
Note

The best practice here would be to clone the Partner Community User profile, and go through all the user permissions with a fine-toothed comb to ensure that all the settings are ones that you want.

    • Role (if asked): Pyramid Construction Inc. Partner User
    • Deselect Salesforce CRM Content User.
    • Deselect Receive Salesforce CRM Content Email Alerts.
    • Select the Generate new password and notify user immediately checkbox.
  1. Click Save.
  2. Navigate back to the Pyramid Construction account.
  3. Click the Pyramid Emergency Generators opportunity and click Change Owner from the dropdown.
  4. Change the owner from yourself to Pat Stumuller.
  5. Click Submit.

Now log in to the partner portal as Barbara Levy to see if you can see any Pyramid Construction opportunities.

  1. From the App Launcher, select Contacts.
  2. Select Barbara Levy.
  3. From the dropdown menu, select Log in to Experience as User.
  4. In the portal, select Sales > Opportunities from the navigation menu.

Do you see any Pyramid Construction opportunities? You better not! If you remember, your opportunity external org-wide defaults are set to private, so you shouldn’t see any Pyramid Construction opportunities here.

Share Opportunities Using Account Relationships

Let’s see how Maria gives access to opportunities owned by Pyramid Construction to Express Logistics and Transport users (which include Barbara Levy).

First she has to enable the account relationship feature in her org.

  1. In Salesforce Setup, enter digital experiences in the Quick Find box and select Settings.
  2. Select the checkbox next to Enable Account Relationships.
  3. Click Save.

Important: Once you enable account relationships in your org, you can’t disable the feature.

After you enable account relationships, you have a whole new object (Account Relationships) available in your org and can set up account relationship data sharing rules.

Note

Only one sharing rule can contain the same Account Relationship Type and Object Type field values. For example, you can have only one sharing rule that combines the Lead.OwnerId Object Type field value and “Distributor” Account Relationship Type field value.

Maria now needs to add the account relationship related lists to the account page layout. Why is this necessary? Because once she sets up the account relationship data-sharing rule, any internal user can use the related lists to create business relationships for data access.

  1. In Salesforce Setup, click Object Manager | Account | Page Layouts | Account Layout.
  2. Click Related Lists.
  3. Drag the Account Relationships: Account From and Account Relationships: Account To Related Lists on to the page.
  4. Click Save.
  5. In the Overwrite Users' Related List Customizations? dialogue, click Yes.

Then Maria sets up an account relationship data sharing rule to meet Maya’s business needs.

  1. From Salesforce Setup, enter account relationship in the Quick Find box, and then select Account Relationship Data Sharing Rule Settings. You may need to refresh your page for the Account Relationship Data Sharing Rule Settings to show up.
  2. Click New.
  3. Enter the following information:
    • Name: Share Opportunities
    • Developer Name: share_opportunities
    • Description: Sharing opportunities between accounts.
    • Account Relationship Type: Distributor
    • Access Level: Read/Write
    • Object Type: Opportunity
    • Account To Criteria Field: Account ID
  1. Click Save.

So, what does this new rule do? An account relationship data sharing rule identifies the account relationship type, the type of information that you want to share, and the access level to the records. The account relationship type is perhaps the most important part of this equation: it’s what connects the sharing rule with the account relationship (which we set up in a little bit). Your org comes equipped with several account relationship types in place, but you can add more if your business needs require them.

Now that Maria has associated sharing logic to the Distributor relationship, she needs to define the specific distributor/reseller relationships.

  1. From the App Launcher, select Accounts.
  2. Select Express Logistics and Transport.
  3. Click New in the Account Relationships: Account From related list.
  4. Enter the following information:
    • Name: Share Opportunities with Express
    • Account From: Express Logistics and Transport
    • Account To: Pyramid Construction
    • Account Relationship Type: Distributor
    • Click Save.

New account relationship

In account relationships, Account From is the account that gets access to data, and Account To is the account that gives access to its data. And as we mentioned before, the Account Relationship Type field is what connects all the dots in the org.

Now let’s log back in to the portal as Barbara Levy and see what opportunities she sees.

  1. From the App Launcher, select Contacts.
  2. Select Barbara Levy.
  3. From the dropdown menu, select Log in to Site as User.
  4. In the portal, select Sales | Opportunities from the navigation menu.

Do you see the Pyramid Construction opportunity? How’s that for some sharing magic?

Some things to note: We had you change the opportunity owner earlier in this step to show that you can share the opportunity regardless of owner. And even though Maria, the admin, set up the account relationship on the account, any Salesforce user with the right permissions can easily set up relationships between accounts in a jiffy. That allows for super granular sharing of data that your business users can control, without having to ask for an admin’s help to set up sharing rules.

See How Much You Shared!

Look at you! You came, you shared, you conquered. Or something like that. Let’s recap what you did.

  • Created a bare-bones partner portal using Partner Central
  • Set up an external sharing model
  • Created partner accounts and users
  • Added a new user to the Salesforce role hierarchy
  • Used sharing rules to share records via role hierarchies and account roles
  • Used a sharing set to share records
  • Created an account relationship to share records

Here’s how Maria (and you) met the initial requirements:

What are you sharing?

Who owns it?

Who are you sharing it with?

How is it shared?

Opportunities

Partner user

Partner users in the same account, and Salesforce users in the role hierarchy

Account roles in the role hierarchy

Opportunities

Partner user

Partner users in a different account

Sharing rules

Cases

Customer user

Other customer users on the same account

Sharing set

Opportunities

Partner or internal users

Partner users associated to a different account

Account relationship

Congratulations, you sharing wiz! Now go forth and use all your accumulated knowledge to share your records with the external users who need to see them most.

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback