+ Start a Discussion
Ross.ax1563Ross.ax1563 

StandardController(xxxx).New()

Hi All

Is there any way I can return a pagereference that is the standard new page for a given object with a specified record type?  I thought there would be a StandardController().new() function? I have also tried to "edit" a "new" record as follows..

a=new icu_assessment__c();
          a.recordtypeid=[SELECT id FROM recordtype WHERE developername='Medication' LIMIT 1].Id;
         }
         Pagereference acctPage = new ApexPages.StandardController(a).edit();
         acctPage.setRedirect(true);
         return acctpage;


Many thanks for any help 
Ross


magicforce9magicforce9
Hi,

Unfortunately there isn't a new() function for StandardController. You might want to try the solution posted here : 

http://www.fishofprey.com/2012/03/salesforce-save-and-new-method-for.html

Thanks,
Mohammed