0

In the PopCommerce's Detail.xml there is a parameter productId being passed to screen. How do I pass that parameter to service-call ?

I have tried below code in service call but this doesn't work

<field-map field-name="productId" from="productId"/>

The parameter in the screen is

<parameter name="productId" required="true"/>

and the service I have defined is

<transition name="createProductReview">
    <service-call name="create#ProductReview" web-send-json-response="true">
        <field-map field-name="productStoreId" value="POPC_DEFAULT"/>
        <field-map field-name="productId" from="how do I use the productId parameter here ?"/>
        <field-map field-name="userId" from="ec.user.userAccount.userId"/>
        <field-map field-name="statusId" value="PrvwPending"/>
    </service-call>
    <default-response type="none"/>
</transition>
Abdullah Shaikh
  • 2,567
  • 6
  • 30
  • 43

1 Answers1

0

The line you mentioned is the correct approach, all parameters are put into the context and can be used as fields from there. To be specific, this line:

<field-map field-name="productId" from="productId"/>

Note that you can use the in-map with the Groovy Map syntax ([:]) for these as well, and it's a bit cleaner.

If that isn't working then the issue is most likely that the productId isn't being passed to the request that calls the transition.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8