user742102
user742102

Reputation: 1365

is it possible to access the view state from a webflow controller action?

i have a controller that is not on webflow but need to redirect it to a weblflow. The problem is the view I need to access is inside an action of a webflow.

here is my webflow

class EditSpouseContactInfoController {

def index = { redirect(action:"editSpouseContact") }

def editSpouseContactFlow = {

    start{
        action {

           //some codes here
        }

        on("success").to("editSpouseContact")
        on(Exception).to("editSpouseContact")
    }

    editSpouseContact {

        /************************************/
        // Veteran Marital History Processing
        /************************************/
        on("addMaritalHistory"){

            flow.contactInstance.properties = params

            if(!flow.maritalHistoryLst){
                flow.maritalHistoryLst = []
            }
            conversation.maritalHistoryInstance = new MaritalHistory()
            conversation.maritalHistoryInstance.isVeteranMaritalHistory = false


        }.to("editSpouseMaritalHistory")



    }
}

here is my non weblow controller:

 def addMaritalHistory={
        MySession session = MySession.getMySession(request, params.id)

        def caseInstance = CmCase.get(params.cmCaseIdCmCase.id as Long)
        redirect(controller: "editSpouseContactInfo",  action: "editSpouseContact ", id:caseInstance.id)
    }

The line above works but is it possible for me to directly access addMaritalHistory inside editSpouseContact?like instead of using the above action it would be action: "addMaritalHistory"? Of course it is not working but is there a way to call that as action? thanks

Upvotes: 0

Views: 462

Answers (1)

Ian Roberts
Ian Roberts

Reputation: 122364

The whole point of web flow is that you can't jump directly into the middle of a flow from outside it. You'll have to add some logic to the initial start state to check for certain parameters in the incoming params and jump to the appropriate state from there.

Upvotes: 1

Related Questions