[Coldbox 4.0.0] - Can I Pass Event Collection in setNextEvent()?

I wanted to know if there was a way to pass the event collection in the setNextEvent function? I have a large amount of data in the event that I would like to pass onto the next event. Thank you.

Look into the persists attribute.

Thanks, I found out what my problem was, I just didn’t catch it sooner. I was using the persistStruct with the setNextEvent function. And as I mentioned I wanted to pass the event collection with it. The problem is that I ended up in an endless toop it seems. This is what I think was happening, even though I was setting the next event, the fact that I was passing in the even collection, which has an event attribute too, that value was overriding my value in the next event function. Once I set the value outside the setNextEvent function it worked fine. Not sure I going to continue to do this, but I’m testing a migration from Mach II to ColdBox, and you could pass the event into announceEvent along with a new event value, which the developer had working. I was just trying to test setNextEvent with the same functionality. Looking at what is passed, I think they over killed it by passing everything though. Here is my temporary solution when passing event collection:

<cfset event.setValue(“event”,“parts.deleteSuccess”)>
<cfset setNextEvent(event=“parts,deleteSuccess”,persistStruct=event.getCollection())>

Marc

I would agree that passing everything is probably overkill. Also, remember that persisting rc values can be brittle. If the user hits the refresh button for instance, the values might be missing.

I would recommend using something like session storage for persisting data between screens. If you’re on Railo, the session scope can be stored in an external cache such as Couchbase.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yeah, if you are not careful, you can get into infinite loops.

In our shop we've opted to use persistStruct and only pass what is needed.
It is self-documenting and easier to follow than some other methods.