首页 > 代码库 > 重写 Standard Delete Button

重写 Standard Delete Button

 

<apex:page standardController="Account" extensions="accountDelete" action="{!deleterecord}">
    <apex:pageMessages />
</apex:page>

public with sharing class accountDelete {
    apexpages.standardcontroller controller;
    public accountDelete(ApexPages.StandardController controller) {
        this.controller = controller;
    }
    public pagereference deleteRecord() {
        try {
            delete controller.getRecord();
            return new pagereference(‘/home/home.jsp‘);  //return new pagereference(‘/001/o‘);   ----------执行完controller 后跳转到的页面;
        } catch(exception e) {
            apexpages.addmessages(e);
        }
        return null;
    }
}

重写 Standard Delete Button