You need to sign in to do that
Don't have an account?
hoagieryder
Lookup Field in Visualforce Page
I am trying to insert the Opportunity Owner field in a visualforce page that I have created that is basically a replica of our standard Opportunities Details Page. Right now it is not showing up, what am I doing wrong?
<apex:page standardcontroller="Opportunity" extensions="NewOpportunityCT"> <apex:sectionHeader title="New Opportunity"/> <apex:form > <apex:pageBlock title="New Opportunity" mode="edit"> <apex:pageBlockButtons title="New Opportunity"> <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Opportunity Information"> <apex:outputField value="{!opportunity.OwnerId}"/> <apex:inputField value="{!opportunity.CloseDate}"/> <apex:inputField value="{!opportunity.stagename}"/> <apex:inputField value="{!opportunity.accountid}"/> <apex:inputField value="{!opportunity.probability}"/> <apex:inputField value="{!opportunity.type}"/> <apex:inputField value="{!opportunity.amount}"/> <apex:inputField value="{!opportunity.id}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Additional Information" columns="1"> <apex:inputField value="{!opportunity.leadsource}"/> <apex:inputField value="{!opportunity.nextstep}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Description Information" columns="1"> <apex:inputField value="{!opportunity.description}"/> <apex:inputField value="{!opportunity.Competitors__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
if i understood your question correctly, did you pass the Opportunity Id in the Url of your page for to view the record details.
Example:
https://www.na1.salesforce.com/apex/yourVfpage?id=OpportunityId
Sales4ce
No, this page is only being displayed when a user clicks the "New" button under opportunities. I overrode the new button because I do not want the Opportunity Name field to be displayed when creating a new opportunity. On the standard new opportunities page, the Opportunity Owner field appears as an output box with the name of the user that created the Opportunity.
aah, i know what you are looking for.
Opportunity Owner field has the value of the User name who clicked on the "New" button.
User Object are accessible globally using $ symbol.
This example might help you:
Sales4ce
That worked great, thank you so much! I previously got the name to display but was not able to display it in the standard format.
Since you were so helpful, I ran into one other problem and was wondering if you had a quick solution. In the new page when I select the Stage dropdown, the Probabilty % field is not generated like it is in the standard opportunity page. Do I need to use apex:actionSupport to get the percent to generate depending on the dropdown value?
You should use a controller extension and then in the Visualforce page use the Action Support tag to rerender for event="onchange".
This should help you :
VF page:
Apex Controller:
FYI, this approach violates best practises as if at all you want to change the picklistvalues and their corresponding probabilities the code would not work. I would see if anyone might come up with a better approach.
I shall keep an eye on this for a better solution.
Sales4ce