I have tried to persist variables with setNextRoute method but I can't
use it in the next route.
Is there some configuration that I must set in my instance?
e.g.:
<cffunction name="route1" access="public" returntype="void"
output="false" >
<cfargument name="event"
type="coldbox.system.beans.requestContext" hint="RequestContext
Object" />
<cfset var rc = event.getCollection() />
Look at the API, I don’t think you are using the method correctly.
Also, please note that in M5 release of 3.0.0 setNextEvent() will be the only method used for relocation. We got carried away during the years and have 3 at the moment: setNExtEvent(), setNextRoute() and relocate(). All three will be consolidated to setNextEvent() with named parameters.
If you use the persist argument, that list of variables MUST exist in the request collection in order to get persisted.
If you want to do a la carte flashing of variables. Use the Flash object that is already configured on all handlers,layouts, views, plugins, interceptors.