You need to sign in to do that
Don't have an account?
Eric Fortenberry
Create New Contact Button
Hello, I am trying to create a New Contact button to go along with my new visualforce page. Can you someone please help me better understand how to create buttons, specifically the New Contact button, and how the action urlfor works? Thanks!
Hi Eric,
try this:
<apex:outputLink value="{!URLFOR($Action.Contact.New)}">New</apex:outputLink>
You can change it to button by using apex:commandbutton tag instead.
Here's what I've got so far, but the problem is that when I click New Contact button it renders itself within the visualforce page that I have added to the Account layout page. I would like it to work just like the standard New Contact button that navigates to the create new contact page.
Screenshot available here: http://cl.ly/1R330v0n2e0H2U2o2N0t
Hi Eric,
The problem is that Salesforce is putting your VF page into an iframe and so the location of the iframe is being changed and not the 'opener' window. try something like
You may need to fiddle with this a bit but you should be able to get it to work when the Javascript is correct.
Cheers,
Rich.
Is there a way to pass in the current account id to the new contact wizard in order to specify a default parent?
Hi Eric,
If you are trying to create a button on Account pagelayout ,please add Contact related list in Account Page Layout to achieve this.
If you are going for a custom VF then
You can create a button on the related list.
If my solution worked for you mark it as resolved.
Thanks.
Hi EDLJames,
Create a VF & Apex class[Fetch the currentID from Account Detail page URL & redirect user to ('//003/e?retURL=%'+currentID+'&accid='+currentID)
If my solution worked for you mark it as resolved.
Thanks.
From what I understand, using the sObject prefix and constructing the URL above is not supported, and it's better to use the Action global variable instead. Here's what I came up with for the new contact button on the contact related list for an account..
{!URLFOR($Action.Contact.NewContact,null,[con4_lkid=id],true)}. Id is the id of the current account. con4_lkid is the html id attribute for the related account id on the standard new contact page. Maybe it is better to use the accid param instead, but I haven't tried that.
Also, the following works for impementing the Merge contact button:
{!URLFOR($Action.Contact.Merge,Id)}
Cheers,
- James
I tried the Merge URL and its working fine, But after we merge, the page is going to Contact related list Visualforce Page. it has to go to accounts page as standard button goes to.
I tried couple of options but could not get it.
can you help me with this.
thanks!!