I need to create a custom button on my Opportunity Page Layout and when it is pressed this button needs to create automatically a Quote. Basically, the point of this is to avoid clicking so much. I wrote some code but I don't know if it's good or bad and I don't know how to continue to this.
public class MyController {
public String currentRecordId {get;set;}
public String parameterValue {get;set;}
public Opportunity opp {get;set;}
public MyController(ApexPages.StandardController controller){
currentRecordId = ApexPages.currentPage().getparameters().get('id');
opp = [Select id From Opportunity where id =: currentRecordId];
parameterValue =ApexPages.currentPage().getparameters().get('nameParam');
Quote qo = new Quote();
insert qo;
}
}