SMAX: Send a notification based on calculation

Hi all,

In problems we have a Root Cause Target Time field. When this Target Time is 4 days from expiring we would like to send out a notification. For example what I am thinking is the following:

${{days(now(), entity.RootCauseTargetTime) < 345600000}

Send notification to recipients using template with parameter


The 345600000 is 4 days in ms. Could something like this work? Where should we locate such a business rule (After change?) ? As you only really want to send out the notification once, and not constantly.

Documentation used: Expression Language functions and syntax - Enterprise Service Management


  • Verified Answer

    +1  

    Hello

    If you add the rule on "After change", there needs to be a trigger to update the record. If there is no trigger, the rule will not run. My suggestion is to add a "per schedule" rule ("Calculated timer schedule" type) and set the "execution date" parameter to

    ${first_non_empty_value(entity.RootCauseTargetTime, 0) - 4*24*60*60*1000}

    Best regards,

    Brindusa

  • 0 in reply to   

    Hi Brindusa,

    Thank you, would this be what you are suggesting?

    If ${{days(now(), entity.RootCauseTargetTime) < 345600000} is true, schedule execution at ${first_non_empty_value(entity.RootCauseTargetTime, 0) - 4*24*60*60*1000} Send Notification 




    I tested this, by for example setting the root cause target time to 4 days + 2 minutes from now and then waiting for the 2 minutes to pass but no notificaion is being triggered:



    Kind regards,

    Sander

  • 0   in reply to 

    Hi Sander,

    You should remove the "days" part from the if-condition. The way you wrote it means the difference between two dates is 345600000 days. It should be a straight diff of the two timestamps.

    Best regards,

    Brindusa

  • 0 in reply to   

    Hi Brindusa,

    Yes thank you this solved it. Just for documentation purpose and for other users to use:

    If ${(now() - entity.RootCauseTargetTime) < 345600000} is true, schedule execution at ${first_non_empty_value(entity.RootCauseTargetTime, 0) - 4*24*60*60*1000} and execute if runtime condition(optional) is true
    Send notification to ${entity.OwnedByPerson} using Notification template for Root Cause Target time breaches with parameters



    Kind regards,

    Sander