Issue with <transition> tag in moqui

82 Views Asked by At
<transition name="abc">
<actions>
<if condition="update != null">
<service-call name="update#someEntity"/>
</if>
</actions>
<default-response url="."/>
</transition>

Above code doesn't work. i.e. if I put log statements, it goes inside if block but update doesn't happen in DB entity. It is also verified that all params/values/p.keys etc are passed properly with proper values from FORM which invokes this transition on submitting.

One other thing which was noticed is, it works perfectly when is changed as below (i.e. there is only a service call element inside transition and no any changes made to any other code anywhere in screen/other places):

<transition name="abc">
<service-call name="update#someEntity"/>
<default-response url="."/>
</transition>

Any guidance on this please?

1

There are 1 best solutions below

0
On BEST ANSWER

The Making Apps with Moqui explains the differences when service-call is used directly under the transition element as opposed to inside actions.

With service-call directly under the transition element it assumes you want to use the "context" as the in-map and the out-map, unless you specify something different.

Normally (i.e. within actions) the service-call element does not assume this, it wouldn't make sense not to specify what you want to do pass to the service (in-map) and it would be very confusing to have service outputs added to the context by default.

To fix your first code example you need to add in-map and, if needed, out-map attributes, i.e.:

<service-call name="update#someEntity" in-map="context" out-map="context"/>

That should fix it.