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
Connector Team 2Connector Team 2 

how to get id of Page

Hello guys,

How to redired on below page after click the button. I want to redirect on following page after click their page page. How to get id of this page?

User-added image
Best Answer chosen by Connector Team 2
Connector Team 2Connector Team 2
I found the solution using this code:


Schema.DescribeSObjectResult destination = destinationSObject.getDescribe(); PageReference pageRef = new PageReference('/' + destination.getKeyPrefix() ); pageRef.setRedirect(true); return pageRef;
 

All Answers

Derhyk Doggett -Derhyk Doggett -

I think you will want to redirect utilizing the name of the page in some fashion. The visualforce page will have a unique name.
Depending on how you're acheiving this you'll need to specificy additional parameters like record id.
In Setup-Develop-Pages you can view all the visualforce pages in your org.

-derhyk

ArmouryArmoury
This is the list view on the object? then you can try redirecting it using the three letter object's prefix. For Example for Account  it is 001. So in the custom button, select the content source as 'URL' and just paste the content as 
/001
If it is a custom object, then i guess probably you have to go for apex solution to get this prefix.
Connector Team 2Connector Team 2
It is not Account object. It is third party custom object. how to use apex solution?
ArmouryArmoury
Can you explain a bit more on the requirement. Like where this button is placed? on standard page or a vf page? Was this button already created or it is new? if it is created then what type it is (javascript/URL/VF).. etc..
Connector Team 2Connector Team 2
There is one List view page of Third pary. I put my own custom button on it.

If customer is select 5 bills and press my custom button, those all bills posted. one want to return back on that list vew page.

every time url comes like this:

/a0K?fcf=00Bo0000001uHgv

How to get this url. a0K change sometime a3D or a0V like that. 

 
Connector Team 2Connector Team 2
I found the solution using this code:


Schema.DescribeSObjectResult destination = destinationSObject.getDescribe(); PageReference pageRef = new PageReference('/' + destination.getKeyPrefix() ); pageRef.setRedirect(true); return pageRef;
 
This was selected as the best answer