Yes sure Jacques,
I already implement both but before suggest it as code, I preferred to
expose the logic to be sure that we going to on the good way :)
If you confirm that this idea isn't wrong (break pattern or something
like that) I will open the issue to load the code
Cheers,
Nicolas
On 14/06/2022 17:21, Jacques Le Roux wrote:
> Hi Pierre, Nicolas,
>
> I like the idea of the right and wrong messages from form. Could we
> not have both (request-map and form) to use them accordingly to our
> (custom for instance) needs?
>
> Jacques
>
> Le 14/06/2022 à 09:12, Pierre Gaudin a écrit :
>> 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
>>
>>