Tuesday, April 12, 2016

[Salesforce] The Sobject Crusade: AccountPartner

Back to the Sobject Crusade list.

Source: AccountPartner

This object links 2 accounts in a partnership relation.

To create a new AccountPartner object, add the Partners related list on the Account object:

Click the New button and add as many Account partners as you want, setting also a role in the partnership:

This action populates the related list:

Note that, on the other Account's related list, there will be the same relationship but with a different type:

This means that for each partner relationship we'll have 2 object:
  • One AccountPartner for the wanted relation (with the specified role type)
  • One AccountPartner for the reverse relation (with the "reverse" role type)

The reverse value of the role is taken from the PartnerRole object in the ReverseRole field.

The AccountPartner records can be created also in the Opportunity's Partners related list, and the records will come with the OpportunityId field set and a Primary flag:

That outputs in the related list:

And in the main Account object:

From the SOQL point of view let's execute the following query:

Select Id, AccountFrom.Name, AccountTo.Name, Opportunity.Name, Role, IsPrimary from AccountPartner Where AccountFromId = '00124000003vaBu' or AccountToId='00124000003vaBu'

No comments:

Post a Comment