I just actually read through your code-- you aren’t ever using the private request collection. Instead of using instance.context, you need to be using the locally varred collection variable. Do you see how the collection var defaults to instance.context and then is replaced with instance.privateContext if arguments.private is true. Essentially your function as it stands now will always look in the public rc and never in the private rc.
Yes, I know-- I pasted in “instance.context” in my E-mail since that’s how the 2.6.x code worked, but that was just to get you started. You need to be able to read through the existing code in a function and determine what it does before modifying it to retain the same behavior.
Also, I wouldn’t recommend changing how the default value functionality works. Imagine an if statement like so:
Always returning a default value of 1 would reverse the logic of that if. I have no clue what was causing your endless redirect loop, but there’s probably a similar if statement somewhere in the framework that is dependent upon the default behavior working like it usually does.
Remember that the framework uses the event object as well so you have to be careful to maintain the original contract that method has with the code calling it. Now, what you COULD do is create a brand new method that only your code uses called getValueSpecial() or whatever you want.
Does that all make sense?