Process Definition triggering too much

I have created one process definition and activated. In PD it check for the Module's related module. If related module has some specific values then process trigger mail to user.

I am creating records in Target module through API. I have set it for First Update only but  it is triggering  multiple times.

Parents Reply Children
  • In any of the logic hooks, do you call save() on the record manually? That could be one of the reasons. 

  • The code that triggers the PDs, is a Logic Hook. It is an after_save Logic Hook with the order of 100. Every time you save a record, the PD will be triggered just like all of the other Logic Hooks.

    My guess is that the record being saved multiple times?

  • But according to my observation, they don't actually work at the order of 100. Although it is mentioned in the community I analyzed it in detail. There is no proper order. If we place the order 100 then still there is no guarantee that it will run at the last. 
    These all are work in parallel fashion sometimes it runs before and sometimes it runs after.
    So, the only solution from my side explicitly checked the triggered module in the Logic Hook to make the distinction.

  • ,

    going off memory here, as I have not checked right now:

    - I believe the hooks triggering SugarBPM are application level hooks, not module level hooks

    - I believe that application level hooks trigger before module level hooks

    - Going by the above two statements, if you want something else to trigger BEFORE, you would have to create an application hook with order < 100 through the extension framework. On the other hand, I would personally act always after the relevant BPM in most real-life cases... wouldn't you?

    Hope it helps answer the ordering question, and feel free to try that out on a sandbox system too!

    Cheers

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

  • Hi ,

    Thank you for the detailed feedback. The statement which you mentioned "I believe the hooks triggering SugarBPM are application level hooks, not module level hooks" I am not sure about the application hooks that PD also triggers for them too or not because in my project in which I experienced this behavior had no hook at the application level.

    But I am pretty much sure about it that PD triggers for the module level hooks because suppose we created an after_save logic hook for the Contacts modules in which we are doing something and suppose we defined a PD for "Create Contact" when defined criteria will meet then the records which will create by the PD will also trigger my Logic Hook which I defined at the module level for Contacts.