Skip to main content
Mak One fragte in #Apex

I have to customize edit, view, delete for Attachments in Opportunity Page Layout.

On delete button I have following lines in Visualforce Page:

<apex:commandLink styleClass="ankit" value="del" onclick="return confirm('Are you sure?')" action="{!delAttachAndNote}" > <apex:param name="attachId" value="{!item.Id}" assignTo="{!delId}" /> </apex:commandLink>

And below is code in Apex class which is "with sharing":

 public String delId{get;set;}

 public void delAttachAndNote(){

        Database.delete(delId);     

}

I tried changing it to delete new Attachment(Id=delId), etc. But still no luck.

Why Salesforce is not taking care of permissions here and Is there any alternative? Also, we cannot get URL for deleting Attachment or Notes.
2 Antworten
  1. 28. Juli 2015, 16:17
    Are you sure you are testing this functionality by logging in as a user who doesn't have the permission to delete the attachment?
0/9000