Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:47:32+00:00 2026-06-13T16:47:32+00:00

I’m very new to working with Visualforce and Salesforce, so please bear with me

  • 0

I’m very new to working with Visualforce and Salesforce, so please bear with me on this…I’m teaching myself how to build visualforce pages by replicating a form that our sales rep use to document orders received. I’m having a really hard time figuring out how to do some (probably) very basic things, and I’m hoping someone can help point me in the right direction. I’ve found a lot of instructions on how to do things that are either part of what I want or similar but not what I’m looking for, and it’s made me very very confused about what needs to be done to make this particular goal work.

Here’s what I’ve done so far…

I’ve set up a Lookup field on my page that allows the user to populate who the sales rep is (using the User object). I’m kind of confused as to why I’m presented with a textbox and a search button, and not just presented with a drop-down box of Reps to select from, but I guess that’s neither here nor there…

<apex:page standardController="Order__c" extensions="OrderNewExtension">
<apex:actionRegion >
    <apex:inputField value="{!Order__c.User__c}" required="true" id="userID">
        <apex:actionSupport event="onchange" reRender="salesRepDetails" />
    </apex:inputField>
</apex:actionRegion>

<apex:outputPanel id="salesRepDetails" rendered="true">
    <table border="0" cellspacing="0" cellpadding="5" width="75%" style="border: 1px solid magenta;">
        <tr>
            <td colspan="2" width="50%">&nbsp;</td>
            <td><apex:outputLabel value="Phone: " for="repPhone" /></td>
            <td class="data">***Something needs to go here***</td>
        </tr>
        ...
    </table>
</apex:outputPanel>

I’d like to do two things with this –

1) After the user chooses the sales rep is, I want the chosen rep’s email and phone number to display.
2) (sorta optional) I’d like this field to be pre-populated with the current user’s name and data, that way the only time the rep would have to be looked up is when one of our support staff is entering something in for someone else. Does this make sense?

I’m not sure what else is needed for anyone to help me, but if it’s within my power to get that info on here, I will do so.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:47:33+00:00Added an answer on June 13, 2026 at 4:47 pm

    Your Controller:

    public with sharing class yourController
    {
        // Defining objects
        public User selectedUser { get; set; }
        public Order__c order { get; set; }
    
        // Constructor where the user data will be pre-populated
        public yourController()
        {
            order = new Order__c();
            order.User__c = UserInfo.getUserId();
            selectedUser = [ Select Id, Email, Phone From User Where Id = :UserInfo.getUserId() ];
        }
    
        // Method for reading selected user data
        public pageReference readUser()
        {
            selectedUser = [ Select Id, Email, Phone From User Where Id = :order.User__c ];
            return null;
        } 
    }
    

    Visualforce Page:

    <apex:outputPanel id="userDetails">
        <apex:pageBlock>
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!order.User__c}">
                    <apex:actionSupport event="onchange" action="{!readUser}" reRender="userDetails"/>
                </apex:inputField>
                <apex:outputField value="{!selectedUser.email}"/>
                <apex:outputField value="{!selectedUser.phone}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>    
    </apex:outputPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.