You need to sign in to do that
Don't have an account?

How to navigate to the edit page dynamically?
Hi Folks,
From the controller, I need to navigate to the Employee page dynamically by clicking a 'New Employee' button.
I can hardcode like '/a0F/', but i need this to happen dynamically since I am going to create a managed package the key prefix can vary.
Also, I like to populate some of the custom filed values from the controller. How to get the field ID's dynamically for the same.
If you provide some useful information then it will be more helpful. If possible, give me some code examples.
Thanks
Raj
You can get the key prefix by using the describe method
Assuming Employee is a Custom Object you've created -
String prefix = Employee__c.sObjectType.getDescribe().getKeyPrefix();
PageReference empPgRef = new PageReference('/' + prefix + '/e');
empPgRef.setRedirect(true);
return empPgRef;
Can you be more clear about your question? How can you Navigate from the controller? You can navigate from one VF page to another VF page.
Well if you want
Check this code to navigate to an id. Hope this will be of some use.
This is what I understood by your question.
For the later part of the question check this
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html
This link has informaton on how to get the field ID's.