1

I was creating a custom output link to delete related record from viusal force page.

 <apex:outputLink onClick="return confirmDelete()" value="/setup/own/deleteredirect.jsp">Del
       <apex:param name="Id" value="{!id}"/>
     <apex:param name="delID" value="{!o.Id}"/>
     <apex:param name="retURL" value="/apex/CustomTicketsave?id={!id}"/>
       </apex:outputLink>

but i was getting error as

     The attempted delete was invalid for your session. Please confirm your delete.

can some one suggest me how to over come this

enter image description here

1
  • 1
    I just deleted my answer as I just realized my answer used commandlink instead.
    – PepeFloyd
    Jun 15, 2015 at 12:17

1 Answer 1

6

If you want to delete a record then use URLFOR instead of statically giving url for your destination. You can achieve it in a much simpler way. Use this code:-

<apex:outputLink value="{!URLFOR($Action.Account.delete, account.id)}" onclick="return window.confirm('Are you sure?');">Delete</apex:outputLink> 

Hope it will help.

3
  • 1
    Hi @Vivek Any idea how to stop this method from redirecting the page?
    – user24634
    Oct 9, 2015 at 14:25
  • @SamCousins same problem coming in my page also...how did you rectify that?
    – Anzar
    Sep 10, 2016 at 23:57
  • Please add 'return false' in onclick attribute, that will prevent redirecting. Sep 12, 2016 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .