-
Notifications
You must be signed in to change notification settings - Fork 909
Add incidenthelper snippet #1877
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
Add incidenthelper snippet #1877
Conversation
WillemZeiler
left a comment
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 included some comments for you to look at, once these are changed, feel free to resubmit a PR.
| ga.addParam('sysparm_name','getOpenIncidents'); | ||
| ga.getXMLAnswer(function(response){ | ||
| var list = JSON.parse(response || '[]'); | ||
| console.log(list); |
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.
Can you add an example of what the output will look like? This will help others more easily understand what the code does.
| getOpenIncidents: function() { | ||
| var gr = new GlideRecord('incident'); | ||
| gr.addQuery('active', true); | ||
| gr.orderByDesc('sys_created_on'); |
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.
Why are you ordering descending on created on? Add this to your readme or a comment.
| var gr = new GlideRecord('incident'); | ||
| gr.addQuery('active', true); | ||
| gr.orderByDesc('sys_created_on'); | ||
| gr.setLimit(50); |
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.
Why are you limiting to 50? Can you add this to the readme or include a comment?
| var list = []; | ||
| while (gr.next()) { | ||
| list.push({ | ||
| number: gr.getValue('number'), |
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.
Perhaps you can include in the readme that this code now only pushes these attributes, and not the full Incident?
PR Description:
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