AnsweredAssumed Answered

Going to a record when changing tabs

Question asked by anothersmurf on Sep 24, 2012
Latest reply on Sep 25, 2012 by anothersmurf

Hello. I have a tabbed layout. When I change to a particular tab, I want to constrain my found set. I am able to do this much successfully by using the OnTabSwitch script trigger with a simple script that constrains the found set the way I want. So far so good.


The problem is, the user ends up on the same record number as before the found set was constrained. If you were on record 8/100 before, you wind up on record 8/25 after, for example. What I want to do, though, is arrive at a record which corresponds meaningfully to the one the user started off on before changing tabs. Post-constrain, that's going to mean a different record number.


So I modified my script. After the constrain, the script loops through the records until it arrives at the desired record, at which point the loop exits, leaving the user on the desired record.


I know that the script works because I can step through it in Script Debugger when changing tabs. I can watch the script constrain the found set, and then loop through to the desired record.


However, after the script ends, the tab switches and leaves the user on the wrong record. The found set is constrained as called for in the script, but it is as though the loop-to-desired-record part never happened. Even though I just watched it happen.


So, is there any way to do this? ie arrive on a desired record at the end of a tab switch?