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
Daniel Roberts 23Daniel Roberts 23 

Global action for creating contacts

I'm doing some trailheads on visual force pages, and in this particular module, you learn that you can use the following code snippet to create accounts. 
 
<apex:outputLink value="{!URLFOR($Action.Account.New)}">
    Create New Account
               
</apex:outputLink>

However, I can't get it to do the same thing for contacts when I replace Account with contact. And I get an error that says "Field$Action.Contact.New does not exist. Check Spelling" 

The code that I have is this: 
 
<apex:pageBlock>
        <apex:pageBlockSection>
            <apex:outputLink value="{!URLFOR($Action.Contact.New)}">
    Create New Contact
</apex:outputLink>
            </apex:pageBlockSection>
         </apex:pageBlock>

The documentation says that the "new method" is compatible with Contacts, I just don't know how to get it to work. 

Thanks, 
Best Answer chosen by Daniel Roberts 23
kishna 15kishna 15
Hi Daniel,

try below snippet 

<apex:page >
    <apex:outputLink value="{!URLFOR($Action.Contact.NewContact)}">
        Create New contact          
    </apex:outputLink>
</apex:page>

All Answers

kishna 15kishna 15
Hi Daniel,

try below snippet 

<apex:page >
    <apex:outputLink value="{!URLFOR($Action.Contact.NewContact)}">
        Create New contact          
    </apex:outputLink>
</apex:page>
This was selected as the best answer
Daniel Roberts 23Daniel Roberts 23
I'm not sure why that didn't work for me, but it worked using your snippet. 
 
Daniel Roberts 23Daniel Roberts 23
Ah, I see "NewContact" instead of just "New". Weird....