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
deepak kumar 13deepak kumar 13 

Need help to create output link

Hi,
I need to create edit and delete output link for contact object records which is lookup to account and my vf page looks like standard account detail page and when i click edit link it should edit the record and delete option should delete the record.
i dont know how to create the link..any help...

Thanks, in advance..
Best Answer chosen by deepak kumar 13
PratikPratik (Salesforce Developers) 
Hi Deepak,

Here is the working code:

<apex:page standardController="account" > 

    <apex:form >
    
        <apex:pageBlock title="Account Contacts">
        
        
            <apex:pageBlockTable value="{!account.contacts}" var="cont">
            
            <apex:column >
            
            <apex:outputLink value="{!URLFOR($Action.Contact.Edit, cont.id)}">
            Edit
            </apex:outputLink>
            
            <apex:outputLink value="{!URLFOR($Action.Contact.Delete, cont.id)}">
            Delete
            </apex:outputLink>
            
            </apex:column>
            <apex:column value="{!cont.firstname}"/>
            <apex:column value="{!cont.lastname}"/>
            
            </apex:pageBlockTable>
        
        
        </apex:pageBlock>
    
    
    </apex:form>

</apex:page>



Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.

All Answers

PratikPratik (Salesforce Developers) 
Hi Deepak,

Here is the working code:

<apex:page standardController="account" > 

    <apex:form >
    
        <apex:pageBlock title="Account Contacts">
        
        
            <apex:pageBlockTable value="{!account.contacts}" var="cont">
            
            <apex:column >
            
            <apex:outputLink value="{!URLFOR($Action.Contact.Edit, cont.id)}">
            Edit
            </apex:outputLink>
            
            <apex:outputLink value="{!URLFOR($Action.Contact.Delete, cont.id)}">
            Delete
            </apex:outputLink>
            
            </apex:column>
            <apex:column value="{!cont.firstname}"/>
            <apex:column value="{!cont.lastname}"/>
            
            </apex:pageBlockTable>
        
        
        </apex:pageBlock>
    
    
    </apex:form>

</apex:page>



Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
This was selected as the best answer
PratikPratik (Salesforce Developers) 
Glad it helped!

For more standard controller actions you can refer to:
http://www.salesforce.com/docs/developer/pages/Content/pages_controller_std_actions.htm

Thanks,
Pratik