0
我有3個自定義視覺頁面。查看記錄,編輯哪些編輯和創建新記錄的新視圖。編輯和新建有一個保存和新建按鈕。當我點擊save和new時,我需要一個重定向,一條新的記錄,以及幾個要清除的字段,但是所有以前的數據都是通過重定向傳輸的。保存和新建按鈕不會清除字段
我的頂點代碼..
public PageReference saveAndNew() {
try {
// Save the current sObject
sController.save();
Schema.DescribeSObjectResult describeResult = sController.getRecord().getSObjectType().getDescribe();
// Create PageReference for creating a new sObject and add any inbound query string parameters.
PageReference pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e?' + queryString);
// Don't redirect with the viewstate of the current record.
pr.setRedirect(true);
eventPackageRevenueBreakdown = new eventPackageRevenueBreakdown__c();
eventPackageRevenueBreakdown.Name = null;
eventpackageRevenueBreakdown.AdminIsIncludedInInclusivePrice__c = false;
return pr;
} catch(Exception e) {
// Don't redirect if something goes wrong. May be a validation or trigger issue on save.
ApexPages.addMessages(e);
return null;
}
}