cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Creating a trigger rule that sends notification after 48 hours

DanR.
10-Marble

Creating a trigger rule that sends notification after 48 hours

I'm trying to create a trigger rule that will send an email notification to a higher level manager after an issue has been in a given state for 48 hours.

This is like issue escalation. I look at the out-of-the-book escalate.js script, but I do not understand how to use at and it does not allow you to enter an escalation time. What I mean is there is no box to to enter X hours or days before the trigger is fully executed.

How can this be done?

11 REPLIES 11

I am not sure how familiar you are with triggers in general, the Integrity Admin guide pdf can be very helpful for the background information on how they work.

There are 2 main ways to fire a trigger, based on a scheduled time or based on an event (there are also some more complex mechanisms around time entry and requirements functionality, but thats not quite relevant).

To achieve your goal of "email after 48 hours in state X", you probably want to go with a scheduled trigger because a rule-based trigger will only run when the issue is changed in some way... so if the issue is sitting idle for 48 hours, a rule based trigger will not be able to fire for that item.

That scheduled trigger can run hourly, every few hours, or nightly, depending on your business needs.

The scheduled trigger will run against every item found in a query it runs against, in this case a query for all items in state X for longer than 48 hours.

To build that query, you may need to add some fields to the item types you are interested in, such as a computed date-time field which captures when the item entered the state X or a pickfield to identify if the item has already been escalated to a certain level.

Once you have built the query and added any necessary fields, the escalate.js trigger parameters should start to make more sense.

To sum up:

1) Build a query which finds all the items to be escalated, adding new fields if necessary

2) Use that query with the escalate.js trigger (or write a new trigger script that exactly meets your needs)

Matt

This might work for me. I will give it a try and let you know how it goes. I am very familiar with triggers, although some of the out-of-the-box scripts leave me scratching my head. We currently use a modified version of AdvancedEmail.js that works very well.

Thank you

That escalate.js script is difficult to figure out. The documentation that goes along with leaves a lot to be desired. For example, what is suppose to go in the 'Last Escalated At' field?

From looking at the script, it seems the "Last Escalated At" holds the timestamp of the last time the escalate.js trigger processed the Issue. If that data is not useful to you, ignoring the parameter seems ok.

I agree with you that most of the out-of-the box scripts are not that great. We really only use emailAdvanced.js, everything else is pretty much custom scripts so they work exactly as we need.

I wish there was documentation available on writting these scripts.

I really do not understand why that field is there. If is holds the last time stamp, why would you put something in there? How do you set the escalation to fire in 48 hours?

We've been using MKS for nearly 11 years, so my organization has a good deal of MKS maturity However, we are currently looking for a different tool.

I think the idea is that the trigger itself is the only one to populate the field for later reporting purposes, so you would provide the name of the blank field.

You lost me. I don't understand. You talking about the 'Last Escalated At'? How do I set this trigger to fire at 48 hours?

The 48 hours will need to be part of the query definition for the scheduled trigger running escalate.js.

I don't know how to get that to work. I can create queries, but how do you have that query show issues in a given state after 48 hours?

Its not something you can query directly, you will need to use a computed field to help.

You can have a computed timestamp field which holds when the issue went to your given state (dateLastEntered("Given State")) and then use that field in the query definition as being older than 48 hours..

You could also have a computed logical field which does both the timestamp and 48 hour compare and then query for items where the field = true;

(dateDiff(dateLastEntered("Given State"), now()) > (48*60*60) )

Matt

I created a Date field with a computation definition of "(DateLastEnter("Ownership ID")) but all that does is insert the date when it started in the "Ownership ID" state. What do I do with that? I know I need to have a query using that new date field, but I'm not sure how I use that new field.

The logical field sounds like a better option for me. I'm having a difficult time with the functions.

Top Tags