0

I would like to integrate a javascript dialog into the start of a web flow where the option selected determines if an existing object is added to the flow or a new one is.

<on-entry>
<evaluate expression="appService.checkMembershipStatus(memberId)"/>
   // this will check if the state is 'RENEW' and return boolean
   // If returns true, then show javascript dialog to say "Renew existing?". 
         //If they select 'Yes', the existing membership is loaded into the flowScope. 
         //If they select 'No', then a new membership (object) is loaded into the flowscope
   // else
     // A new memebership (object) is loaded into the flowscope

</on-entry>

<view-state id="begin">
   // continue as normal
</view-state>

Thanks

Kalyan
  • 1,781
  • 11
  • 15
solarwind
  • 327
  • 1
  • 3
  • 17

1 Answers1

1

You can achieve this using <decision-state>. A sample flow is as below

<view-state id="screen1">
    <transition to="checkMembershipStatus" />
</view-state>

<decision-state id="checkMembershipStatus">
    <if test="appService.checkMembershipStatus(memberId)"
        then="renewMembership"
    else="loadNewMember" />
</decision-state>

<!--In this page show a javascript dialog (or custom JSP page) on load to get the answer [YES/NO] -->
<view-state id="renewMembership">
    <transition on="Yes" to="loadExistingMember" />
    <transition on="No" to="loadNewMember" />
</view-state>

<action-state id="loadExistingMember">
   <evaluate expression="loadExistingMember()" result="member" />
   <transition to="begin" />
</action-state>

<action-state id="loadNewMember">
   <evaluate expression="loadnewMember()" result="member" />
   <transition to="begin" />
</action-state>

<view-state id="begin">
   // continue as normal
</view-state>
Kalyan
  • 1,781
  • 11
  • 15