function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael MinnekeerMichael Minnekeer 

commandbutton to open new record edit page bypassing record type selection AND pre filling lookup fields

Hi,

I cannot seem to find an answer that fix my issue. I need a visualforce page that will have multiple command buttons to link to a new record edit page for a single custom object. When using URLFOR I can either use:
  • <apex:commandButton  URLFOR($Action.Bonus_Approval_Request__c.New, null, [p3="0126F0000012I7X", CF00N6F00000En3fy={!Opportunity.Name}, CF00N6F00000En3fy_lkid={!Opportunity.Id}, save=1]) />
    • this solution doesn't work because it comes up with the record type selection page and setting default record type is not an option as I will need to deploy this solution across different objects that will have a record type pre selected for the relative object
  • <apex:commandButton value="New Bonus Request Approval Conversations" action={!URLFOR('/a0J/e?&RecordType=0126F0000012I7X&CF00N6F00000En3fy={!Opportunity.Name}&CF00N6F00000En3fy_lkid={!Opportunity.Id}')} />
    • this solution doesn't work because I cannot prefill my opportunity lookup anymore with this hack
Is there something I am missing or another option I can use for Commandbutton? Thanks