Is there a way to push a message from a HOOK to the user ?

Hello,

I have a quick question : Is there a way to push a message from a HOOK to the user ?

The purpose is easy ; during my hook, several job are processed and can return non blocking messages. Is there a way to promote thoses message to the user interface (the same way the Success message is displayed after the process for instance).

Many thanks for your help.

PS : I am aware about the sugar validation process using JS, but the message are provided by external app after insertion, and I don't want to trigger them before my record is saved.

Any solution my superheroes ??? 

Parents
  • Hi

    Is there a particular reason you want to use a logic hook for this?

    When I need to execute logic that would warn the user about potential validation breaches I tend to use the controller in the view, call a custom API to do the validation, and present a warning, confirmation or error alert to user depending on the nature of the breach.
    The downside is that you potentially need to do this on multiple controllers, though they can all refer to the same API, since records can be edited in record, list and subpanel views.

    FrancescaS

Reply
  • Hi

    Is there a particular reason you want to use a logic hook for this?

    When I need to execute logic that would warn the user about potential validation breaches I tend to use the controller in the view, call a custom API to do the validation, and present a warning, confirmation or error alert to user depending on the nature of the breach.
    The downside is that you potentially need to do this on multiple controllers, though they can all refer to the same API, since records can be edited in record, list and subpanel views.

    FrancescaS

Children
  • Hi Francesca,

    yes ; the save of the bean must be completed. But, during the save, we are calling an external solution with some data of the bean. This external solution is provided us a "summary" of warning or error that should not be considered as an error in Sugar.

    So we would like to warn the user that, even if Sugar was able to process the data he entered, he will have to pay attention to that and this while handle the file in the external solution.

    Of course, we can send an email, create a notification etc., but it less visual than a message at the same level that the SUCCESS save message.

    Fred