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 Reply Children
  • unfortunately it doesn't work ; it seems to be something dedicated to BWC modules. Am I wrong?

  • Yes, you are right. Unfortunately, this one is only for BWC modules. I was also using it for BWC modules.

    Keeping in mind what you want to achieve; I can think of the following two options from the top of my head. 

    1. As also suggested, override model save in JS. On the success of save, call custom API sending the bean information to the external solution. Then show the response or message received from that API to the user.

    2. If you still want to use the logic hooks for this purpose. Create two new fields. One for storing the message received from an external source. The second one to decide if the message already shown to the user or not. Now save the information in these fields via logic hook. After that, override the RecordView JS for that specific module and on the model sync, checks the shown bit. If the message text is not yet shown then just show the message stored in the custom field earlier and then set the bit to true so that message will not show up again on refresh of the record.

    I hope this will solve your problem. Happy Coding Slight smile

    Kind Regards,

    Junaid