+ Start a Discussion
CyberfireCyberfire 

"Previous" or "Next" button on records - is it possible?

A user had a request that seemed to be pretty straight-forward, but upon doing research I can't find any way to accomplish it.

All we're looking to do is have a "Next" button that takes the user to the next record in that object that is owned by the user.

User A is in Leads, clicks next, and it goes to the next lead (alphabetically?)

Is this even possible?
werewolfwerewolf
If you have a well-defined notion of what "Previous" and "Next" actually mean, then yes, you could make some custom buttons with Javascript that query for what's previous or next and navigate there.  Don't expect it to derive from a list view though -- you'll probably have a hard time trying to get those buttons to work with some list view.  But, as I say, if there's a fixed definition of the order of these records, then you can make that without too much trouble.
CyberfireCyberfire
Yes, this would actually be a custom button withing the lead page view, not in the list view.

What would I have the javascript query? When a user is looking at the leads, I'm not sure how to tell the system what would be next - would I just do it off of next lead ID owned by user x?
SteveBowerSteveBower
Hi, I think you are correct and there is not a built-in way to set up Next/Previous buttons when looking at the overview page for a record.

You could write an S-Control and make it available as two Buttons (passing a "Next"/"Previous" parameter to the s-control) which would query the records in question, order them alphabetically or however you want, find the record you're on now and then navigate you to the next/previous record.  That's an expensive solution in terms of processing time and query resources, especially if there are a lot of records in question, but it would do the job.

It can also (perhaps better) be done through a VisualForce page which extends the standard controller for the Object in question.  But again, you're writing code, and doing extra processing for each navigation.

Perhaps you could accomplish it through just training your users to use a multi-tabbed browser?  Open one tab to the list view of the records in question, and then show the users how to open a record in a new tab, close the tab when done, and then do the same for the next record.

Hope this helps, Steve.

p.s. Seems like a nice Idea for ideas.salesforce.com, somewhere you'd need to specify the sort order for next/previous.

CyberfireCyberfire
I think that sorting the records by creation date would probably a good option - that or alphabetically.

The S-Control option might take awhile in terms of resources, especially if we have 20 odd users using it simultaneously - not sure how the database would like that.

The Visualforce option isn't a bad idea, except that i'm basically a complete visualforce newb, and don't have time to dig into it at the moment.

I guess I'll toss it on the ideas site and hope it happens...
SteveBowerSteveBower
On thinking about it, If you happen to have an auto-increment field on the record for some reason (or perhaps you want to add one for this purpose), then that makes it more feasible because it can proxy for creation time, and you can limit the query to get the ID to the one record with the incremented or decremented field value.  Just a thought, Steve.