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
Vipin K 10Vipin K 10 

Community - VF page -Display Current Logged in User Accounts

Hi All,

I have created a VF page for community to add employee details. I have used a custom object (Employee) for which the master object is Account. I have also added the Account field on the VF page. Now i need to set the account value as the account of the logged in user[Community user Account). How can i achieve this?

<h5>Emergency Contact Information</h5>
                                    <div class="form-field-row">
                                        <div class="form-field-label">First Name</div>
                                        <div class="form-field-input"><apex:inputText value="{!Employee__c.Emergency_First_Name__c}" /></div>
                                    </div>
                                    <div class="form-field-row">
                                        <div class="form-field-label">Last Name</div>
                                        <div class="form-field-input"><apex:inputText value="{!Employee__c.Emergency_Last_Name__c}" /></div>
                                    </div>
                                    <div class="form-field-row">
                                        <div class="form-field-label">Last Name</div>
                                        <div class="form-field-input"><apex:inputText value="{!Employee__c.Account__c}" /></div>
                                    </div>
Uvais KomathUvais Komath

Accounts in salesforce are not related to users. Account means a company that we do business with. Its not something like a facebook account or gmail account

Hence the logged in user doesnt have an account linked with it.

You cant add a relationship like lookup or master from user to anything else.

 

 

Vipin K 10Vipin K 10
Its not the user but its the contact to which we have given community access and that contact is related to an account.