You need to sign in to do that
Don't have an account?
Praveen Bonalu
Access the Account Teams from the Contact record
I Have tried to Access the Account Team Members from the contact record and i am not able to achieve it.
How would I Query the AccountTeamMembers from the Contact Object
MY VF:
Controller
How would I Query the AccountTeamMembers from the Contact Object
MY VF:
<apex:page controller="MyProfilePageController"> <apex:form id="theForm"> <apex:pageBlock title="{!$Label.site.my_profile}"> <apex:pageBlockSection columns="1" title="My Team"> <apex:pageBlockTable value="{!myTeam}" var="r"> <apex:column value="{!r.Account.Name}"/> <apex:column value="{!r.Phone}"/> <apex:column value="{!r.Email}"/> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form>
Controller
public class MyProfilePageController { private User user; public List<Contact> myTeam { get; set; } public User getUser() { return user; } public MyProfilePageController() { user = [SELECT id, email, username, usertype,firstname, lastname, phone, title, street, city, country, postalcode, state, localesidkey, mobilephone, extension, fax, WHERE id = :UserInfo.getUserId()]; myTeam = [Select Id, Account.Name, FirstName, LastName, Title, Phone, Email from Contact where AccountId=:user.Contact.AccountId ORDER BY Name ASC]; } }
I've added an example of how you could fetch the team members from the account id, which you can fetch from the Contact record like so:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountteammember.htm
I have called the above mentioned method in my class but how can i access this method in the order to display in visualforce page .
Thanks
Praveen