Just curious to know about the clone button functionality. When I create a record and click on clone button , its allowing me to change the master details lookup record. But When I have writtern custom code, and use my clone button, its not allowing me to do that( That master detail field coming as readable only). Below is my custom clone button code. My main object is Custom__c and other object is child__c
Id customId = ApexPages.currentPage().getParameters().get('id');
String RecordTypeStr = ApexPages.currentPage().getParameters().get('RecordType');
system.debug('RecordTypeStr>>'+RecordTypeStr);
RecordType recType = [SELECT Id,Name FROM RecordType WHERE SObjectType ='Custom__c' and Name=:RecordTypeStr];
List<Custom__c> cusObjList = Database.query('SELECT '+Metadata.getCommaSeparatedFieldNames(new Custom__c()) +
' FROM Custom__c WHERE id=\''+customId+'\'');
Custom__c cloneRec = cusObjList[0].clone(false,false);
cloneRec.RecordTypeId = recType.Id;
insert cloneRec;
return new PageReference('/' + cloneRec.Id +'/e?retURL=%2F' +cloneRec.Id);