Hey everyone,

by pressing the submit button on a form, I am trying to call several
services one after the other. First I want to call a service that creates a
productCategory and then use the productCategoryId and the rest of the form
field values to call the addProductCategoryToCategory service.

Now my code looks like this: 

I created a form as the following Forms*xml:

  <form name="test" target="createCategoryI18n" type="single" >
    
            <!-- Create Category -->
            <field name="productCategoryId" title="">
                <display/>
            </field>
            
            <field name="productCategoryTypeId" >
            <hidden value="QUICKADD_CATEGORY" />
        </field>

                <!-- Add ParentRollup -->
            <field name="fromDate" >
            <date-time type="timestamp" default-value="${nowTimestamp}"/>
        </field>
          
             <field name="parentProductCategoryId"
title="${uiLabelMap.FormFieldTitle_parentCategoryId}"
tooltip="tooltip-text">
            <drop-down allow-empty="false" current-description="" 
current="selected" no-current-selected-key="guys" >
                <entity-options description="${categoryName}"
key-field-name="productCategoryId"
entity-name="ProductCategoryRollupAndChild">
                    <entity-constraint name="parentProductCategoryId"
operator="equals" value="bproot"/> 
                    <entity-order-by field-name="categoryName"/>
                </entity-options>
            </drop-down>
        </field>
            
            <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit
button-type="button"/></field>
    </form>


Then I added a service as such:

 <service name="createCategoryI18n" default-entity-name="ProductCategory"
engine="entity-auto" invoke="create" auth="true">
                            <description>Create a Category</description>
                                    <permission-service 
service-name="exampleGenericPermission"
main-action="CREATE"/>
                                    <auto-attributes include="pk" mode="OUT" 
optional="false"/>
                                <auto-attributes include="nonpk" mode="INOUT" 
optional="true"/>
                </service>



And lastly I tried to have a SECA create the needed Rollup once needed:

    <eca service="createCategoryI18n" event="commit">
       <action service="addProductCategoryToCategory " mode="sync"/>
    </eca>




But of course, this won't work, because then the form parameters go missing.
I know that this makes sense, as the SECAs are not context related and the
parameters not needed by a service are removed from the context... yet my
question remains: how can I accomplish the above? is there a way to have a
form call multiple services that are related to one another?
-- 
View this message in context: 
http://www.nabble.com/Form-Widget-call-multiple-services--tp21836332p21836332.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to