Bucket Group Age Calculation - This calculates the bucket group age calculation#1873
Bucket Group Age Calculation - This calculates the bucket group age calculation#1873spnegi wants to merge 4 commits intoServiceNowDevProgram:mainfrom
Conversation
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
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