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
RajashriRajashri 

Output LinK Delete Code

Hi

I have created the output link for Edit/Remove

Can anyone please send me code ...how to delete the record  using Output link ?

 <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteCampaign('{!row.Id}');" style="font-weight:bold">Del</a>
Best Answer chosen by Rajashri
Venkat PolisettiVenkat Polisetti
Use the JavaScript method "confirmDelete()" and it is provided to you by SF on the page already.
 
<apex:outputLink value="{!URLFOR($Action.Campaign.Delete, row.Id)}" onClick="return confirmDelete()">
    Delete
</apex:outputLink>

Cheers.
 

All Answers

Venkat PolisettiVenkat Polisetti
You do not need to call a JavaScript method to do that.
 
<apex:outputLink value="{!URLFOR($Action.Campaign.Delete, row.Id)}">
    Delete
</apex:outputLink>

 
RajashriRajashri
Thanks Venkat..But i want to add warning messge also along with it.How can i do that?

Below code works fine..but how to add warning message?

   <apex:outputLink title=""  value="{!URLFOR($Action.Campaign.Delete, cpmc.Id)}" style="font-weight:bold">Remove</apex:outputLink>
Venkat PolisettiVenkat Polisetti
Use the JavaScript method "confirmDelete()" and it is provided to you by SF on the page already.
 
<apex:outputLink value="{!URLFOR($Action.Campaign.Delete, row.Id)}" onClick="return confirmDelete()">
    Delete
</apex:outputLink>

Cheers.
 
This was selected as the best answer
RajashriRajashri
Thanks Venkat!