You need to sign in to do that
Don't have an account?
Eric Fortenberry
How to populate a new opportunity with the current account name?
I have created a custom button to create a New Opportunity and I'd like to pass in the Account Name, but am not sure how. Here is the code I have in my visualforce page. I think I need to add additional paramaters to the !URLFOR part, but if someone could help me out I'd appreciate it! Thanks.
<apex:page standardController="Account" extensions="AccountExt" sidebar="false" showHeader="false"> <script> function doRedirect() { window.parent.location.href = '{!URLFOR($Action.Opportunity.New)}'; } </script> <apex:form > <apex:pageBlock title="Opportunities"> <apex:pageBlockButtons location="top"> <apex:commandbutton onClick="doRedirect()" value="New Opportunity"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!AllOpportunities}" var="item"> <apex:column headervalue="Opportunity Name"> <apex:outputLink value="/{!item.Id}" target="_parent"><apex:outputField value="{!item.Name}" /></apex:outputLink> </apex:column> <apex:column value="{!item.StageName}" /> <apex:column value="{!item.Amount}" /> <apex:column value="{!item.CloseDate}" /> <apex:column value="{!item.OwnerId}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
I tried this, but it's not working:
You can try like this : using a Cutom Buttonand running Java script
https://na1.salesforce.com/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL={!Account.Id}&save_new_url=<url>&opp={!Account.Name}