Skip to main content
Mak One 님이 #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개
  1. 2015년 7월 28일 오후 4: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