8

I am trying to use the following on a VF page, but I am getting an error when I try to save the VF page.

<apex:outputLink value="{!URLFOR($Action.Attachment.Delete, attachment.Id)}"/>

Error: Field $Action.Attachment.Delete does not exist. Check spelling

The following works in the same page:

<apex:outputLink value="{!URLFOR($Action.Attachment.Download, attachment.Id)}" target="_blank">

Thanks!

0

2 Answers 2

2

I don't believe this is possible via an output link. In years past you could use /setup/own/deleteredirect.jsp?delID=<record id> to do this but salesforce added a cross-site request forgery protection that prevents this from working without an additional confirmation.

Likewise the standard delete button actually includes a hidden _CONFIRMATIONTOKEN parameter that appears to be randomly generated for each page view.

So, if you want to do this you'll need to actually use an action component like apex:commandLink or apex:commandButton and call a controller method to perform the delete.

1
  • I think you are right. I will have to create and call a controller method, this action doesn't seem to be available for Attachments.
    – PepeFloyd
    Commented Sep 13, 2012 at 10:24
1

You're missing a closing quote on the first line. Try finishing it with " target="_blank">

0

You must log in to answer this question.

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