You need to sign in to do that
Don't have an account?

Custom clone button on Account issue
Hi All,
I am creating a custom clone button on account. this is my VF page and controller. Button works fine but the issue is :
when i click clone the new record is created and saved. I want when i click clone the page should remain in edit form and i should save it manually.
Please help.
Here is my controller:
I am creating a custom clone button on account. this is my VF page and controller. Button works fine but the issue is :
when i click clone the new record is created and saved. I want when i click clone the page should remain in edit form and i should save it manually.
Please help.
<apex:page standardController="Account" extensions="AccountController" action="{!autoRun}"> <apex:sectionHeader title="Auto-Running Apex Code"/> <apex:outputPanel > You tried calling Apex Code from a button. If you see this page, something went wrong. You should have been redirected back to the record you clicked the button from. </apex:outputPanel> </apex:page>
Here is my controller:
public with sharing class AccountController { public Account objAccount {get;set;} public string AccountID; private Account objNewAccount; Map<String, Schema.SObjectField> mapAccountFields; public AccountController(ApexPages.StandardController controller) { } public PageReference autoRun() { AccountID = ApexPages.currentPage().getParameters().get('id'); if(AccountID != null) { mapAccountFields = Schema.SObjectType.Account.fields.getMap() ; objNewAccount = [ select id,OwnerId,AccountId,Status__c from Account where id = :AccountID ] ; objAccount = objNewAccount.Account(false,true,false,false); insert objaccount; return new PageReference('/'+objAccount.id); } return null; } }
All Answers
So use the below controller This is new one!