Web Logic Hook on custom module not called

We are using the Web Logic Hooks functionality in case of two modules of ours.
During the development of an internal tool which is using the SugarCRM REST API as well, we decided to use the same Web Logic Hooks functionality, but instead of an already defined module we wanted to use it for a custom module made by the Sugar Studio/ Module builder feature.
We had some experiments and we've realised that the configured endpoint is not called.
I've looked over the documentation and I've found this page:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.2/Architecture/Module_Builder/#Adding_Custom_Logic_Using_Code
Which says that a custom module might need some additional coding and configuration if we would like to enable Web Logic Hooks feature, but it's not 100% clear to me what needs to be done from our side.

My question is, what should we do in order to work with a module made by Sugar Studio/ Module builder feature and Web Logic Hooks functionality together? How could we reach a point where we can listen to an after_save event with a module made by Sugar Studio/ Module builder feature?

Has someone experiments with defining WEb Logic Hooks for a customer module?

BR

  • Do you refer to Logic Hooks or Web Logic Hooks?
    I'm asking because there is only 1 appearance of the word "Web" in the doc available via the link.

    I'm not a developer, but calling external systems via REST API from logic hooks is configurable with Logic Builder.
    And, unlike Web Logic Hooks, it allows authorizing to external systems.

    (to read follow the white line)




    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • Hello Paul, 

    When using Web Logic Hooks the data is not sent instantaneously but rather queued and processed later by the Dispatch Web Logic Hook scheduled job.

    This means that the Cron needs to be enabled for the instance. 
    Can you confirm that the Cron is enabled on your tests? 

    Adding on that there are some documented defects that might explain this behavior, can you provide details on the exact Web Logic Hook that's not working so we can check if you are hitting any defect? 


  • This SugarClub thread could be of interest in the context of your question
    sugarclub.sugarcrm.com/.../22849

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient

  • I am refering to Web Logic-Hook, which can be defined in the Admin view of SugarCloud

  • I tried to create a Web Logic Hook on an instance which does have the scheduler activated.

    This is an example of a Web Logic Hook we have in place on an already defined module:

    (note: I changed the URL in this example for the screenshot - in our production system we have a valid URL in place)

    For testing we first tried to copy this web logic hook and set the custom module on the copied logic hook. However no action was caused when new data was created or edited on the custom module.
    Which made us thinking if web logic hooks in custom modules need additional coding/configuration.

  • Hello Paul, 

    The Web Logic Hooks should work for custom modules as they do for stock modules without any further customization. 
    When a Web Logic Hook is triggered the action will be added to the job_queue so a first check would be if an entry is being added for your after_save in the database table.

    Fullscreen
    1
    SELECT * FROM job_queue where name='Dispatch Web Logic Hook' ORDER BY job_queue.date_entered DESC;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    If the entries are not being created you should check an eventual conflict with other custom logic hooks. 

    Web Logic Hooks will create a file in: 
    custom/modules/ppp_modulename/logic_hooks.php

    I have seen cases where developers end up overriding this file with other logic hooks. 
    This is normally avoided by adding the custom logic hooks using the extensions framework. 

    With that cleared you should keep in mind the following defect (https://portal.sugarondemand.com/#supp_Bugs/82879).
    This causes the after_save in record creation to have too much data what might cause a timeout.

    if that ends up being the root cause of your problem the good news is that the defect going through our QA process and will be released ASAP. 

    I hope this helps and let me know how the investigation goes.