Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
Mak One asked 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 answers
  1. Jul 29, 2015, 5:41 AM
    Yes, I am sure. I have tested many times with different users. :(
Loading
0/9000