Business Rule Creation to Calculate Time Spent

Open discussion about our Alloy Navigator 5 application

Business Rule Creation to Calculate Time Spent

Postby SitusIT on Wed Jun 20, 2007 2:07 pm

Has anyone written a business rule to calculate time spent on an incedent, I've tried to create a rule that subtracts the start date from the closed date but have had no luck. Just hoping someone has done this.

Thanks.
SitusIT
Member
 
Posts: 23
Joined: Tue Oct 11, 2005 12:36 pm

Postby pille on Mon Jun 25, 2007 11:15 am

Probably the easiest way to do this is by using DateDiff and some UDFs. For instance here's an example...let's measure the time between the Created date and the Completed Date.

- create an Incident UDF called 'Open Time (minutes)', make it an integer
- create an Incident business rule

Event: Before Object is saved
Criteria: Completed Date is not blank
Action: Update Fields

Field name: Open Time (minutes)
Operation: Calculate
Value: DATEDIFF("Minute",%[Created]%,%[Completed]%)

Of course you may have to build in some more criteria to make sure things are as you want them, for instance maybe if you don't want the Open Time field to be repopulated you'd make sure it was blank, etc.

Either way, the open time field will be populated with the number of minutes between the two dates.
Contact Technical Services directly:
support@alloy-software.com
http://support.alloy-software.com

Paul Ille
Alloy Software
Maximize your IT Universe
Follow us on Twitter: http://twitter.com/alloysoftware
Image
User avatar
pille
Alloy Software
 
Posts: 473
Joined: Thu Aug 11, 2005 3:11 pm
Location: New Jersey, USA

Open Time Field

Postby lina_eleraky on Tue Apr 22, 2008 6:15 am

how can i populate the Open Time Field with something else other than minutes??
lina_eleraky
Junior
 
Posts: 2
Joined: Tue Apr 22, 2008 5:43 am

Re: Open Time Field

Postby pille on Tue Apr 22, 2008 9:29 am

lina_eleraky wrote:how can i populate the Open Time Field with something else other than minutes??


Check out this link - http://msdn2.microsoft.com/en-us/library/ms189794.aspx

It will give you information on the parameters that DATEDIFF allows.
Contact Technical Services directly:
support@alloy-software.com
http://support.alloy-software.com

Paul Ille
Alloy Software
Maximize your IT Universe
Follow us on Twitter: http://twitter.com/alloysoftware
Image
User avatar
pille
Alloy Software
 
Posts: 473
Joined: Thu Aug 11, 2005 3:11 pm
Location: New Jersey, USA

Re:

Postby basheer on Sat Jun 11, 2011 6:36 am

pille wrote:Probably the easiest way to do this is by using DateDiff and some UDFs. For instance here's an example...let's measure the time between the Created date and the Completed Date.

- create an Incident UDF called 'Open Time (minutes)', make it an integer
- create an Incident business rule

Event: Before Object is saved
Criteria: Completed Date is not blank
Action: Update Fields

Field name: Open Time (minutes)
Operation: Calculate
Value: DATEDIFF("Minute",%[Created]%,%[Completed]%)

Of course you may have to build in some more criteria to make sure things are as you want them, for instance maybe if you don't want the Open Time field to be repopulated you'd make sure it was blank, etc.

Either way, the open time field will be populated with the number of minutes between the two dates.


Hi, Thanks for this helpful tip. Just onething, How can I calculate this field for open tickets also? For example, the incident is still open and calculate the open minutes by comparing created date and current datetime if the COMPLETED date is blank (means open). If the completed date present, then calculate as you mentioned in quote.

How can i achieve this?

Thanks for your help
basheer
Member
 
Posts: 10
Joined: Mon Dec 27, 2004 4:27 am

Re: Business Rule Creation to Calculate Time Spent

Postby pille on Mon Jun 13, 2011 9:32 am

For AN5, you'd have to have two separate triggers. One would work on certain statuses when the completed date exists and the other would work on certain statuses when the completed date does not exist.

For instance, one rule would check to see if the status is not resolved or closed and the other needs to check for open statuses.

Then just use the datediff approach, but use the system macro for NOW. Something like this:

Value: DATEDIFF("Minute",%[Created]%,<NOW>)
Contact Technical Services directly:
support@alloy-software.com
http://support.alloy-software.com

Paul Ille
Alloy Software
Maximize your IT Universe
Follow us on Twitter: http://twitter.com/alloysoftware
Image
User avatar
pille
Alloy Software
 
Posts: 473
Joined: Thu Aug 11, 2005 3:11 pm
Location: New Jersey, USA


Return to Alloy Navigator 5 Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron