Skip to content
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

Fix GlideAggregate Query and Data Retrieval for Incident Statistics #1624

Merged

Conversation

Dhruvyadav2000
Copy link
Contributor

Summary: Update Incident_analysis_Resolution_Calculation_GlideAggregate.js

This update fixes the GlideAggregate query for fetching open incident statistics. Previously, the method used to retrieve the 'assigned_to' field and aggregate values was incorrect, causing issues in data retrieval and display. This commit ensures the following:

  • assigned_to is retrieved using getDisplayValue() instead of get(), ensuring proper display of user names.
  • Correctly retrieves aggregate data using getAggregate() for both 'COUNT' and 'AVG' operations to calculate the number of open incidents and average time to close.
  • Provides accurate and meaningful output for each assigned user.

Changes:

  • Replaced ga.get('assigned_to') with ga.getDisplayValue('assigned_to') to get the user display name.
  • Corrected ga.get('result') and ga.get('result.avg_time_to_close') to ga.getAggregate('COUNT', 'number') and ga.getAggregate('AVG', 'time_to_close') respectively.

Impact:

This fix improves the accuracy of the reported incident statistics and ensures the correct data is displayed in the logs for better analysis of incident assignment and closure performance.

Fix GlideAggregate query and data retrieval for incident statistics

- Updated the method to retrieve the 'assigned_to' field using getDisplayValue() instead of get().
- Corrected aggregate data retrieval by using getAggregate() for 'COUNT' and 'AVG' operations.
- Ensured proper calculation and output of open incidents count and average time to close.
Copy link
Contributor

@earlduque earlduque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@earlduque earlduque merged commit 9021722 into ServiceNowDevProgram:main Jan 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants