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 ??? 

  • Hi ,

    I would suggest leveraging the user "Notification" functionality. You can easily create a notification along with the message via logic hook against any user. The user will be notified immediately and the message will be visible in the notification center.

    Kind Regards,

    Junaid

  • Yes, we explored that way, but, unfortunatelly, it is not as "visual" as a popup on the screen after the save to display the "errors / warnngs" provided by the backoffice process.

    Any other idea?

  • Hello Frederic

    Logic Builder can configure hooks to validate Sugar data.
    Look at this recording https://integroscrm.com/webcast-lets-practically-apply-sugar-configuration-over-code-development-8

    If you have any questions, feel free to contact me.

    Regards,
    Mykola

    Integroscrm.com
    We make work in Sugar
    more convenient and efficient

  • OK. In that case, explore the following snippet solution.

    Fullscreen
    1
    SugarApplication::appendErrorMessage('Congrats Record Saved');
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    This would display the message to the current user. You can use the HTML tags as well in the message to show as you like instead of simple text. 

  • 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

  • You can use our Slack integration and notify the user that way.

  • 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

  • Hi Jeff,

    fortunately my customer is not a slack or a teams or any kind of tool like that.

    So we definitely want to alert the user from Sugar screen, in a more visual way than sending an email or creating a notification.

    Fred

  • unfortunately it doesn't work ; it seems to be something dedicated to BWC modules. Am I wrong?

  • Hi Mykola,

    I will check that with my customer.

    Fred

1 2