-
Notifications
You must be signed in to change notification settings - Fork 912
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
Conversation
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.
Thank you for your submission. I have added comments for you to review and adjust. Please expand the readme. As it is not clear at the moment what the added value of this script is versus OOTB reporting and SLA capabilities. Closing this for now. Feel free to submit a PR with the changes.
| @@ -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 | |||
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.
| var openedDate = new GlideDateTime(rec.opened_at.getDisplayValue()); | ||
| var dur = GlideDateTime.subtract(openedDate,actualDateTime ); | ||
| //gs.info("dur"+dur.getNumericValue()) ; | ||
| elapsedTime = dur.getNumericValue()/86400000 ; |
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.
This is not a defined variable. Define it first.
| while (rec.next()) { | ||
| var openedDate = new GlideDateTime(rec.opened_at.getDisplayValue()); | ||
| var dur = GlideDateTime.subtract(openedDate,actualDateTime ); | ||
| //gs.info("dur"+dur.getNumericValue()) ; |
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.
Remove commented out logs or explain if users can add it back in to add functionality.
|
|
||
| rec.setWorkflow(false); // Skip any Business Rules | ||
| rec.autoSysFields(false); // Do not update system fields | ||
| rec.aging_category = aging; |
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.
aging is not defined anywhere. Declare it before using it.
| elapsedTime = dur.getNumericValue()/86400000 ; | ||
| // gs.info ("elapsedTime" + elapsedTime) | ||
| // Check to see when the item was created | ||
| if (elapsedTime <= 2) aging = '0-2 Days'; |
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.
aging is not defined anywhere. Declare it before setting it's value.
| @@ -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. | |||
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.
What is the benefit of these buckets? Why not create a report on the Case SLA for example?
|
Sure. I will work on it. Can you help me opening this request? |
PR Description:
Bucket Group Age Calculation - This calculates the bucket group age calculation. This helps us to run this scheduled job and allow to put bucket level aging on every record and it allows to create the reports on table level.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions