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
coolKarnicoolKarni 

Navigation using custom button in standard page

From a standard page of an standard object,  how can i redirect to next record of the same object??.

To be more clear....

I have a requirement -

In a lead page i have many leads records available.When clicked on one of the lead record a lead detail page will open.And in that lead page i need to place a custom button- "NEXT". such that when clicked on the button it should redirect to next lead record.

 

Instead of clicking on cancel and then redirecting it to main page and from there clicking on respective record to open.

I just want to place a button to redirect it to next record.

 

Is this possible?? If yes, please let me know...

 

Thanks

prashanth

Ispita_NavatarIspita_Navatar

This could have been done easily had it been your custom code, but will get the order in which salesforce returns record.

Had your listing page been a custom one , then you would have known how the records are retreived and could have easily  redirected the user to the next record.

You can probably override the the Tab with your custom listing page , then it will be easy to provide a custom button to go to the next record.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.


coolKarnicoolKarni

Thanks for your reply Ispita.

Actually i can do it using the Apex code and visual force functionality.

But is there any other way to do this.

 

For instance, by using {!cancel} action method we can navigate to the original page from wherethe page has been opened .In the same way is there any other method to show the next record??

 

Thanks

shaan

incuGuSincuGuS

There are several things worth trying out, instead of creating all custom listing.

 

 

  • You can create a Custom Button that calls a VF page, within the VF page you can execute apex and do your thing.
         http://sfdc.arrowpointe.com/2009/01/08/invoke-apex-from-a-custom-button-using-a-visualforce-page/
        In that article someone explains how to achieve the effect, try and see if it fits your needs.

  • You can call JS in a button, and have it do a HTTP Request ( don't remember if it allows you too, but i think so) within that request call a VF page with a parameter and return the Next ID (you must decide the criteria that NEXT uses, creation date? last modified? ) and then return it as the body of the page. read the returned ID in the body of the call and do a redirection there.

Both approachs are very similar, just have in mind what parameters you need , but youll surely end up with a VF page that calls a controller that does the trick. How it interacts with the button depends on whether its a JS button or a VF button.

 

The VF button approach could be very simple if you can grab some parameters , haven't done this myself, i'll try later if i get some spare time and let you know.

 

Hope this helps as an alternative, let me know how it worked and if you can how you coded it ! , i might need it in the future :)

Gaston.