+ Start a Discussion

Visualforce page not deleting record


I have a related list that is a visualforce page. I am trying to use a commandlink to delete records from the related list; however, the code is not working. There is no error message displayed. Any assistance is appreciated!

VF page:
<apex:commandlink value="Del" id="customDelete" onClick="return confirmDelete()">
    <apex:param name="delID" value="{!attorney.ID_1__c}" assignTo="{!SelectedId}"/>

public void customDelete()
        New List<Att_IP__c> att = [SELECT Id FROM Att_IP__c WHERE Id = :SelectedId];
        if (att.size() > 0){
            Delete att;

Michael VerhovskiMichael Verhovski
You may need to check that the sObject records you are trying to delete have the deletable property. Try to execute in Develop console something like

delete [SELECT Id FROM Att_IP__c WHERE Id = :SelectedId];

Thank you, Michael. I used the developer console to execute the delete statement and the status came back successful. I also ensured that the profile I'm using has delete access to the Att_IP__c object. Any other ideas of what I might try?
Does anyone have any other suggestions?
Nikunj DoshiNikunj Doshi
Just ensure that you are initializing SelectedId -> public String SelectedId{get; set;} & also set rerender attribute on command link to "all".

Here`s a detailed blog written by Bob on the topic of passing param http://bobbuzzard.blogspot.sg/2011/07/passing-parameters-to-apex-method-from.html

Hope it helps,
Nikunj Doshi