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

redirect to object layout from visualforce page
Hi I am trying to redirect from a page to object layout.
This is what I am trying but is not working any help will be much appreciated
public PageReference value(){ Account accnt = new Account(); PageReference acctPage = new ApexPages.StandardController(accnt).view(); acctPage.setRedirect(true); return acctPage; }
The prefix will be same if you are planning to move it from Full sandbox to production.
Or else use the following code to dynamically get the ID prefix:
in object_Api add the api name of object
All Answers
Hi,
In your code the accnt is a new account...You need to associate it to some existing account record to goto View page as you can only view existing records!!!!
I want user to create a new account upon directed..so how can I do that?
You can use the following code:
Hi it woked with this..
but in other function I want to transfer it to a custom object for creating a row of record...when I replaced Account with Custom Object..it redirected me to Account only
In the code for pagereference add ID prefix istead of 001 (*which infact is ID prefix for account)..
You can get the ID prefix for your custom object from apex explorer or you can also use the first 3 digits of ID of any record of your custom object e.g. All account records have ID starting with 001
Hope this solve's your problem
If we move from one SFDC environment to other will it remain the same? the ID prefix...?
The prefix will be same if you are planning to move it from Full sandbox to production.
Or else use the following code to dynamically get the ID prefix:
in object_Api add the api name of object
Thanks a lot :)