How to make a vf page redirect to a standard record create page

187 Views Asked by At

This is my code where i have created a button which is placed on related list on which when clicked i want the alert to pop and then direct to a standard record create form on opportunity

> `
> <apex:page standardController="Special_Pricing_Request__c" recordSetVar="Special Pricing Requests">
>  <apex:outputPanel >
>     <apex:outputPanel rendered="true">
>             <script>
> alert('Please ensure that the opportunity product for the opportunity is Updated.');
> window.location.href =" ";
>               </script>
>     </apex:outputPanel>
> </apex:outputPanel>
> </apex:page>
> ````
                                        

I dont know if i have to create a whole create record form which is too lengthy or i use lwc to call create record 
1

There are 1 best solutions below

0
eyescream On

Search the net for URLFOR and "url hacking", "url prepopulation" keywords.

https://help.salesforce.com/s/articleView?id=sf.customize_functions_urlfor.htm&type=5

There are special $variable actions in Visualforce: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_action.htm, you'd need $Action.Opportunity.New

This is a decent tutorial too (although "url hacking" differs a bit between Classic and Lightning UI): https://www.salesforceben.com/salesforce-url-hacking-for-lightning-tutorial/ or if you prefer SF help: https://help.salesforce.com/s/articleView?id=release-notes.rn_general_lex_navigate_to_record_dfv.htm&release=224&type=5