Date and age-based alerts: SugarBPM or scheduled job?

Hello Sugar lovers!

We're getting more and more requirements to perform actions after a date or age has been reached: sleeping opportunities, renewal reminders, escalate accounts without activity... These generally cannot be solved by a report (dashboard or scheduled) since the reporting engine does not allow calculations (eg days before renewal, age since last contact...). 

My first intuition sent me towards a simple BPM with an event-based gateway and/or wait event (no dependency on a developer resource, easily maintainable), but: 

  1. Once the process has started and is "waiting", a priori you can't change the "alert" date, for instance if a contract start date changes (for whatever reason), the delay is recalculated, or any other criteria changes. Can you? 
  2. This will create a waiting process instance for each and every record until it is "closed". AFAIK these processes are polled every minute, which could take a massive hit on performance after a while. Is that correct? 

So what we generally do is:

  1. Develop a daily scheduled job that loops through the records and sets a flag if the criteria are met
  2. Design a BPM that is triggered on the flag change and that performs the necessary actions (sending an email etc)

This works, but any change in the criteria requires code-level modifications (+packaging, deployment...). 

I'd live to read your view on this!



  • Eventually you can encapsulate the criterias into a admin config view. The custom scheduled job can fetch criteries from that config and do the job. This way the maintenance effort will reduce.

    We frequently implement features like that to our customers so they are free to update those config criterias.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Damien,

    we often faced the same issue with many of our customers.

    According to your BPM question, 

    1. in order to solve this, you must define a race between the waiting event AND the trigger field is updated
    2. not really because Sugar will evaluate only the processes with the "next action date" that is reached.

    To improve / facilitate the BPM time management processes but also bring in the possibility to trigger event based on "anniversary", we developped a custom module to trigger date-based events.

    The idea is quite simple : you create as many date trigger definition that will identify the matching records, according to the time based comparison you defined (and if required additionnal SQL filters). Then, when the condition is met, you update the data in a record field of your own (custom or core field), to display the info or to use inside your BPM (and simplify the wait / date field is updated race with a basic wait for a value in this field condition).

    Here is a sample of the configuration screen.

    As for the Sugar BPM, a cron job will then evaluate the actives date trigger definition to identify the corresponding records (so low charge for the server).

    This add-on is also useful when you need to apply a date-based process on existing records.

    If you want more detailled, contact me and we can scheduled a quick demo.

    Have a good day.


  • Hi Frédéric,

    Thanks for your detailed answer! I'm not sure I've understood what you mean by "define a race between the waiting event AND the trigger field is updated", can you elaborate a bit, please? 

    I'l get in touch about your module, but from what I gather the "waiting BPM" approach is valid and scalable? 



    Damien Pochon

    CRM & Digital consultant @ ITS4U Group

  • Hi Damien,

    in my opinion, your BPM should run 2 branches when you are waiting a date to be reached

    • branch 1 : waiting the date to be reached
    • branch 2 : listening if anyone changed the value in the date field you are waiting for

    if the second branch is triggered, you must decide what to do (restart a wait ? do something else?).

    It's described here :

    I hope it will help.


  • Is it possible to provide sample code for this date-based trigger for BPM? I'm surprised it's not built into Sugar. We are using Enterprise v 12 and have use cases that require contract renewals based on 60-90 days before the renewal date. We'd like to have notifications go to the customer as renewal date approaches and tasks added for staff.

  • Develop a daily scheduled job that loops through the records and sets a flag if the criteria are met

    Can a BPM be configured to set the flag instead of a scheduled job?

  • Here is the one example from our Sugar implementation experience:

    1. Create a Note with the subject "Perpetual daily scan"
    a) setup  start operator for Process definition to run on that note is created
    b) add call LB Service in the Process Definition
    c) add with the Wait element workflow, set it to wait for 1 day (hour, month, whatever cycle is needed) and make an infinite loop, so that the Process became perpetual and run according to the cycle 

    2. Draw a Logic Builder flowchart as the implementation of the LB Service was mentioned in the Process Definition
     a) set criterion, e.g. "Check all accounts that have related meetings held within timeframe" - literally express the criteria 
     b) implement data transformation along with data manipulation/external calls etc e.g. "for each account found according to the criteria, calculate smth, make external API call, send Email,  or create related or non-related records"
     c) deploy flowchart implementation zip into Sugar with Module Loader

    This allows to benefit from the perpetual daily/monthly/hourly/ect data scan performed by SugarBPM for processing let's say thousands of accounts in a single operation instead of creating thousands of processes per each account - and that all is achievable no code 

    I'll make an example on ootb sandbox

    Best Regards,
    Dmytro Chupylka
    We make work in Sugar CRM system faster, more convenient and efficient

  • Okay here is an example:

    The Task is -  to provide a single regular perpetual Process that would check for New leads that were not updated to Assigned within t X minutes from registering in Sugar and assign them all to Jim

    Step 1
    Declare LB Service for Criteria check and data processing, provide X as a parameter (minutes_passed)

    Step 2
    Setup simple Process Definition and enable it

    Step 3
    Draw criterion and data processing for running Assignment Logic.
    pls don't lower your expectations in Sugar automation, since there is no-code access to all the out-of-the-box and custom modules.
    E.g. lets 
     - 0. Start processing, read parameter
     - 1. Set the Criterion for scanning data: Find all Leads in the New status
     - 2. Process them all: go through the list of leads found
     - 3. Transform data: if the Lead was created more than minutes_passed ago, then assign it to Jim and set the status to Assigned, then increment the counter of assigned Leads  
     - 4. Note statistics: Create Note record with a number of Leads automatically assigned

    Folow the white line to read:

    Step 4
    Generate Sugar package in a click and install it via Module Loader.


    Now, if you create a new note with subject "START PERPETUAL ASSIGNEMENT", that will run Process Definition and you will get a single instance of the perpetual Process

    Whenever the process runs, it  checks the criterion, process leads, then creates the Note record with statistics:


    That approach is a common Solution Architectural approach that we use while implementing Sugar and suggest it for Sugar Admins with no coding skills  - approach leverages SugarBPM capabilities along with core Sugar platform configurability without writing a line of custom code or involving costly developers for programming and supporting custom jobs

    I hope this makes sense

    Have a nice weekend!

    Best Regards,
    Dmytro Chupylka
    We make work in Sugar CRM system faster, more convenient and efficient

  • as the resident BPM guru, maybe you can confirm if this scenario is possible?
    I tried to find examples on your YouTube BPM videos, but it seems they have all been deleted Cry which even though they were old, still very useful to get the basics

  • , I'm afraid you may have me at least partly confused with someone else. I like solving problems with Sugar BPM and my company produces Upsert BPM Essentials to augment the functionality, but I've never produced any instructional YouTube videos on BPM.

    With that said, I have received similar client requests to what  has highlighted; I agree with his current solution (scheduled job to identify the desired criteria supported by BPM to act when the criteria are met) to circumvent the performance impacts Sugar BPM wait timers can introduce when used at scale.