Announcement Announcement Module
Collapse
No announcement yet.
At What Point is Snapshot Taken? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • At What Point is Snapshot Taken?

    Hi

    I am a little confused about the way webflow records "snapshots" of the flow state.

    I am using webflow 2 to create a wizard which builds up a set of nested business objects step by step.

    I am using a flow-scope variable to hold the business object, and state-scope variables to hold the information the user has posted at each stage of the wizard.

    For example:

    Code:
    ...
    
    <var name="businessObject" class="..." />
    
    <view-state view="myFormView1" model="myForm1">
        <var name="myForm1" class="..." />
        <transition on="next" to="myFormView2">
            <evaluate expression="service.copyInfoFromFormToBusinessObject(myForm1,businessObject)" />
        </transition>
    </view-state>
    
    <view-state view="myFormView2" model="myForm2">
        <var name="myForm2" class="..." />
        <transition on="next" to="myFormView3">
            <evaluate expression="service.copyInfoFromFormToBusinessObject(myForm2,businessObject)" />
        </transition>
    </view-state>
    
    ...
    At each view-state I'm executing code on the "next" transition which updates my business object with the information from that stage's form.

    However, I'm findng that when the user goes back to a previous stage via a link or their back button, the business object already has the information added!

    I was just wondering if anyone could tell me exactly when webflow takes its snapshot of the flow state. I had assumed this would be upon entry into the state, but now I'm starting to think the snapshot might be taken on exit from the state, after my transition expression has been evaluated.

    Is this the case?

  • #2
    I believe that snapshots are taken on state exit.

    ViewState.exit
    -> ViewState.updateHistory
    -> RequestControlContext.updateCurrentFlowExecutionSn apshot
    -> FlowExecutionImpl.updateCurrentFlowExecutionSnapsh ot
    -> FlowExecutionKeyFactory.updateFlowExecutionSnapsho t

    Rather than create a separate viewScope object to hold screen data you could just bind screen components directly to your businessObject?

    Phil.

    Comment


    • #3
      Thanks for the clarification.

      Unfortunately in my case, the user interface used in each view state does not map nicely onto the underlying business object and so the form data must be captured in separate object and processed at the end of the state.

      But anyway, I can work around my problem now that I know what state my snapshots will in

      Comment

      Working...
      X