Skip to Content
author's profile photo Former Member
Former Member

Calling save while clicking on next button in wizard.

Hi,

I have given save tag(wz:save) inside next tag(wz:next). It is not saving the properties defined in prepare > initialize elements. Attached is code snippet for the same.Please provide some input.

alt text

1728-capture.png (29.5 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2014 at 03:51 PM

    HI again,

    Ok so if it is your hard requirement you can do following :

    1) I've created an improvment in our backlog (TSB-1362) and that will be implemented in one of the following sprint and it will be released in 5.5 - then you can request patch for you version if it is acceptable for you ...

    2) You can extend the ConfigurableFlowWidget according to this documentation: and modify the following methods in you custom controller:com.hybris.cockpitng.widgets.configurableflow.ConfigurableFlowController#doNext . The code may look like this below:

     public void doNext(final StepType currentStep)
     {
           super.doNext(currentStep);
           final NextType navigation = currentStep.getNavigation().getNext();
           for(final SaveType saveType : navigation.getSave()){
     
           try
           {
                 persistProperty(saveType.getProperty());
           }
           catch (final ObjectSavingException e)
           {
               showFailureNotification(e);
           }
         }        
     }
     
    
    
    
    
    
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      I have one query?

      I extended the controller class ConfigurableFlowController and created my CustomConfigurableFlowController.

      I have to override the donext() method. But where to register my CustomConfigurableFlowController class such that it would be invoked on next click operation?

      Thanks, Ashwini

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2014 at 02:20 PM

    Hi,

    We don't call save logic when wizard step is changed i.e. objectFacade.save is not called when next, previous button is clicked. In order to perist some properties defined in the please add:

     <wz:navigation id="step1.navigation">
         <wz:cancel/>
             <wz:back/>
             <wz:done>
                 <wz:save property="newProduct"/>
         </wz:done>-
     </wz:navigation>
    
    

    If you have different requirements please describe in details why you need that the newProduct hast to be persisted when wizard change the steps i.e. when in fact wizard is not finalized ....

    Regards Karol

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2014 at 02:40 PM

    Hi karol,

    I have requirement like once particular step is completed(say step 1) item should be saved on clicking next.Once Step1 item is saved,in next step that item should also be populated and only then next step item should be created.

    As per documentation, I had followed this step(mentioned in question).Below is link from where I got reference. https://wiki.hybris.com/display/release5/Configurable+Flow+Wizard+Widget

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2014 at 02:35 PM

    Thank you for your information.

    Again I have one more doubt.Consider if attributes of item1 are present in multiple steps,object will be persisted on each click of next button. If there is any not null field in later step, will cause problem while saving.There will also be performance issue as well.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 08, 2014 at 03:47 PM

    Hi,

    ".... if attributes of item1 are present in multiple steps,object will be persisted on each click of next button..."

    if you share object like 'item1' on multpile steps and if you want to presist when the current step changes then you have to add correct navigation snippet for each step: ....

     <wz:navigation id="step1.navigation">
     <wz:cancel/>
     <wz:back/>
     <wz:next>
     <wz:save property="item1"/>
     </wz:next>
     </wz:navigation>
     .....
     <wz:navigation id="step2.navigation">
     <wz:cancel/>
     <wz:back/>
     <wz:next>
     <wz:save property="item1"/>
     </wz:next>
     </wz:navigation>
    
    

    But if you don't neeed to persist item1 e.g. beetween 4th and 5th step then you can skip the navigation next snippet (especailly wz:save property="item1") then save method won't be performed ....

    If you are wondering about performance - did you consider to perfomed this save only once when entire wizard is completed i.e. using done button ?

    Regards Karol

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.