Hi Nicolas,

The solution by putting the message directly in the request-map response seems to me a good idea. This avoids having to create a service just to overload the return message.

I think the idea of putting the message directly in the screen is less interesting because the same screen can be used in different contexts.

Pierre

Le 13/06/2022 à 15:45, Nicolas Malin a écrit :
Hello,

I wish to expose a thought about the event message returned to an end user.

When you write a screen for edition and wish to inform your end user,
you send your success or error message directly on the request from the
event.

     *****
     <request-map uri="updatePerson">...
         <event type="service" invoke="updatePerson"/>
         <response name="success" type="view-last"/>...
     </request-map>

    PartyServices.java :
         result.put(ModelService.SUCCESS_MESSAGE,
             UtilProperties.getMessage(RES_ERROR,
"person.update.success", locale));

     *****

During an implementation on a custom site, if you want to use a specific
message after updating a person, you need to create a specific service :

     *****
      <request-map uri="updatePersonFromHere">...
         <event type="service" invoke="updatePersonFromHere"/>
         <response name="success" type="view-last"/>...
      </request-map>
    CustomServices.java :
         run service: "updatePerson", with: parameters
         return success("my specific message")
     *****
If you have an other case, an other service

An other vision would be to set the message around the event directly on
the request.

     *****
      <request-map uri="updatePersonFromHere">...
         <event type="service" invoke="updatePerson"/>
         <response name="success" type="view-last">
             <user-message ressource="CustomUiLabels"
value="SuccessUpdatePersonFromHere"/>
         </response>...
      </request-map>

     *****

Why: when you write your custom code, in many case (in any case for me)
you call a generic service or other event type but wish return a exact
message not from the operation in the service but more from where the
call is submitted.

Other idea to improve more we can imagine setting the message direclty
from the form

     *****
    <form type="single" target="updatePerson">
       <field name="_CUSTOM_EVENT_MESSAGE_" ><hidden value="Thanks for
the update ${partyId}"/></field>
       <field name="_CUSTOM_ERROR_MESSAGE_" ><hidden value="ARRRG update
failed"/></field>
     ...
     *****

What is your feeling about that ?

Thanks
Nicolas


Reply via email to