-
Notifications
You must be signed in to change notification settings - Fork 913
Bucket Group Age Calculation - This calculates the bucket group age calculation #1873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| var rec = new GlideRecord('case'); // any table which you want to use | ||
| rec.addEncodedQuery('stateNOT IN60,40, 20'); // filtering out all the closed/cancelled cases | ||
| rec.query(); | ||
| while (rec.next()) { | ||
| var openedDate = new GlideDateTime(rec.opened_at.getDisplayValue()); | ||
| var dur = GlideDateTime.subtract(openedDate,actualDateTime ); | ||
| //gs.info("dur"+dur.getNumericValue()) ; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove commented out logs or explain if users can add it back in to add functionality. |
||
| elapsedTime = dur.getNumericValue()/86400000 ; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a defined variable. Define it first. |
||
| // gs.info ("elapsedTime" + elapsedTime) | ||
| // Check to see when the item was created | ||
| if (elapsedTime <= 2) aging = '0-2 Days'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aging is not defined anywhere. Declare it before setting it's value. |
||
| if (elapsedTime > 2) aging = '3-4 Days'; | ||
| if (elapsedTime > 4) aging = '5-7 Days'; | ||
| if (elapsedTime > 7) aging = '8-15 Days'; | ||
| if (elapsedTime > 15) aging = '16-30 Days'; | ||
| if (elapsedTime > 30) aging = '31-60 Days'; | ||
| if (elapsedTime > 60) aging = '61-90 Days'; | ||
| if (elapsedTime > 90) aging = 'Over 90 Days'; | ||
|
|
||
| rec.setWorkflow(false); // Skip any Business Rules | ||
| rec.autoSysFields(false); // Do not update system fields | ||
| rec.aging_category = aging; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aging is not defined anywhere. Declare it before using it. |
||
| rec.update(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Find out all the cases with the difference in their create date and current date and put them in different buckets of their age. Then you can report on the aging. With this you will be able to run the Bucket Group reporting on tables without using PA. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the benefit of these buckets? Why not create a report on the Case SLA for example? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Active = true or addActiveQuery is better. If you want to stick with this, explain in the comment what states 60, 40, 20 are exactly.