Skip to main content
How to create a button that opens a visual force page from the opportunity object ,which will prompt to fill fields like 

Case record type 

Subject

description

contact name ( look up field)

account name  ( pre populated from the respective opprtunity record)

opportunity ( pre populated from the respective opprtunity record)

task_c ( custom picklist data type )

save button ( this will create a new case record with the given input values for above records)

cancel button

All the above are fields from case object
6 réponses
  1. 24 févr. 2016, 23:09
    Hi Pooja,

    Please create a VF page with the StandardController='Opportunity' with extensions='OpportunityExtensionController'. 

    something like below:

    public class OpportunityExtensionController {

         public Case ca {get; set;}

         public OpportunityExtensionController(ApexPages.StandardController controller) {

               Opportunity opp = (Opportunity) controller.getRecord();

               opp = [Select Id, Name, ........ from Opportunity where Id =: opp.Id];

               ca = new Case();

               ca.OpportunityId = opp.Id;

               ca.AccountId = opp.AccountId;

         }

    }

    Above code will give an idea how to write the VF page and Controller.
0/9000