-
Notifications
You must be signed in to change notification settings - Fork 907
Resolve incident UI page #1762
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
Merged
rohi-v
merged 15 commits into
ServiceNowDevProgram:main
from
naveensnow:Resolve-Incident-Modal
Oct 4, 2025
Merged
Resolve incident UI page #1762
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
24b87b6
Create UIaction.js
naveensnow ed72117
Create resolve_incident_uipage.html
naveensnow 901dc6c
Create resolve_incident_client.js
naveensnow 82354e8
Create scriptinclude.js
naveensnow 5a6c627
Create README.md
naveensnow cac4d59
Update resolve_incident_uipage.html
naveensnow f3711c5
Update README.md
naveensnow 9baf436
Update README.md
naveensnow b0e779d
Update and rename resolve_incident_client.js to ui_page_client.js
naveensnow 1d8db78
Rename UIaction.js to UI_action.js
naveensnow 61a3a21
Rename resolve_incident_uipage.html to ui_page_html.html
naveensnow 8e07820
Update ui_page_client.js
naveensnow 2947662
Update ui_page_html.html
naveensnow 6e382e6
Update ui_page_client.js
naveensnow 626206e
Update ui_page_html.html
naveensnow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
Client-Side Components/UI Pages/Resolve Incident UI Page/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| Use Case: | ||
|
|
||
| Everytime user try to resolve the incident, the resolution codes and resolution notes are mandatory to be entered as it hidden in tabs,Since it is mandatory fields. So to ease the process we introduced a custom UI action will prompt the user | ||
| to enter resolution notes and resolution codes and automatically set the state to Resolved. | ||
|
|
||
| How it Works: | ||
|
|
||
| Navigate the Incident form and make sure the incident is not closed or active is false. | ||
| Click Resolve Incident UI action, it will open an modal with asking resolution notes and resolution code. | ||
| Provide the details and submit. incident is updated with above Resolution notes and codes and set state to be Resolved. | ||
|
|
||
|
|
||
| Below Action Need to Performed: | ||
|
|
||
| 1.Create UI action: | ||
|
|
||
| Navigate to System UI > UI Actions. | ||
| Create a new UI Action with the following details: | ||
| Name: Resolve Incident (or a descriptive name of your choice). | ||
| Table: Incident [incident]. | ||
| Action name: resolve_incident_action (must be a unique, server-safe name). | ||
| Order: A number that determines the position of the button on the form. | ||
| Client: Check this box. This is crucial for running client-side JavaScript. | ||
| Form button: Check this box to display it on the form. | ||
| Onclick: ResolveIncident() (This must match the function name). | ||
| Condition: Set a condition to control when the button is visible (e.g., current.active == true). | ||
|
|
||
| 2.Create Script Include: | ||
|
|
||
| Navigate to System Definition > Script Includes. | ||
| Click New. | ||
| Fill in the form: | ||
| Name: ResolutionProcessor | ||
| Client callable: Check the box. | ||
| Copy the provided script into the Script field. | ||
| Click Submit. | ||
|
|
||
| 3.Create UI page: | ||
|
|
||
| Navigate to System Definition > UI pages | ||
| Fill the HTML and client script. | ||
| Click Submit. | ||
|
|
||
|
|
18 changes: 18 additions & 0 deletions
18
Client-Side Components/UI Pages/Resolve Incident UI Page/UI_action.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| function ResolveIncident() { | ||
| var dialog = new GlideModal("resolve_incident"); | ||
| dialog.setTitle("Resolve Incident"); | ||
| dialog.setPreference('sysparm_record_id', g_form.getUniqueValue()); | ||
| dialog.render(); //Open the dialog | ||
| } | ||
|
|
||
|
|
||
| // Navigate to System UI > UI Actions. | ||
| // Create a new UI Action with the following details: | ||
| // Name: Resolve Incident (or a descriptive name of your choice). | ||
| // Table: Incident [incident]. | ||
| // Action name: resolve_incident_action (must be a unique, server-safe name). | ||
| // Order: A number that determines the position of the button on the form. | ||
| // Client: Check this box. This is crucial for running client-side JavaScript. | ||
| // Form button: Check this box to display it on the form. | ||
| // Onclick: ResolveIncident() (This must match the function name). | ||
| // Condition: Set a condition to control when the button is visible (e.g., current.active == true). |
19 changes: 19 additions & 0 deletions
19
Client-Side Components/UI Pages/Resolve Incident UI Page/scriptinclude.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var ResolutionProcessor = Class.create(); | ||
| ResolutionProcessor.prototype = Object.extendsObject(global.AbstractAjaxProcessor, { | ||
| updateRecord: function() { | ||
| var recordId = this.getParameter('sysparm_record_id'); | ||
| var reason = this.getParameter('sysparm_reason'); | ||
| var resolution = this.getParameter('sysparm_resolution'); | ||
| gs.info("Updating record " + recordId + " with reason: " + reason + " and resolution: " + resolution); | ||
| var grinc = new GlideRecord('incident'); | ||
| if (grinc.get(recordId)) { | ||
| grinc.close_code = resolution; | ||
| grinc.close_notes = reason; | ||
| grinc.state = '6'; //set to resolved | ||
| grinc.update(); | ||
| } else { | ||
| gs.error('No Record found for ' + recordId); | ||
| } | ||
| }, | ||
| type: 'ResolutionProcessor' | ||
| }); |
29 changes: 29 additions & 0 deletions
29
Client-Side Components/UI Pages/Resolve Incident UI Page/ui_page_client.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Below code will be used in client script of UI page as mentioned in README.md file | ||
|
|
||
| function ResolveIncidentOnsubmit(sysId) { //This function is called in UI page HTML section When user clicks the Submit button | ||
| var rejectionReason = document.getElementById('resolution_reason').value.trim(); | ||
| var resolutionCode = document.getElementById('resolution_code').value.trim(); | ||
| if (!rejectionReason || rejectionReason === ' ') { | ||
| alert('Resolution Notes is a mandatory field.'); | ||
| return false; | ||
| } | ||
| if (resolutionCode == 'None') { | ||
| alert('Resolution Code is a mandatory field.'); | ||
| return false; | ||
| } | ||
| var ga = new GlideAjax('ResolutionProcessor'); | ||
| ga.addParam('sysparm_name', 'updateRecord'); | ||
| ga.addParam('sysparm_record_id', sysId); | ||
| ga.addParam('sysparm_reason', rejectionReason); | ||
| ga.addParam('sysparm_resolution', resolutionCode); | ||
| ga.getXML(handleSuccessfulSubmit); | ||
| GlideDialogWindow.get().destroy(); | ||
| return false; | ||
| function handleSuccessfulSubmit(answer) { | ||
| window.location.reload(); | ||
| } | ||
| } | ||
| function closeDialog() { | ||
| GlideDialogWindow.get().destroy(); | ||
| return false; | ||
| } |
27 changes: 27 additions & 0 deletions
27
Client-Side Components/UI Pages/Resolve Incident UI Page/ui_page_html.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> | ||
| <g:evaluate var="jvar_sys_id" expression="RP.getWindowProperties().get('sysparm_record_id')" /> | ||
| <div> | ||
| <p> | ||
| <label for="resolution_reason">Enter the Resolution Notes</label> | ||
| <textarea id="resolution_reason" name="resolution_reason" class="form-control" rows="4" cols="80"></textarea> | ||
| </p> | ||
| <p> | ||
| <label for="resolution_code">Select the Resolution Code</label> | ||
| <select id="resolution_code" name="resolution_code" class="form-control"> | ||
| <option value="None">None</option> | ||
| <option value="No resolution provided">No resolution provided</option> | ||
| <option value="Resolved by request">Resolved by request</option> | ||
| <option value="Resolved by caller">Resolved by caller</option> | ||
| <option value="Solution provided">Solution provided</option> | ||
| <option value="Duplicate">Duplicate</option> | ||
| <option value="Resolved by change">Resolved by change</option> | ||
| <option value="Workaround provided">Workaround provided</option> | ||
| <option value="Known error">Known error</option> | ||
| <option value="Resolved by problem">Resolved by problem</option> | ||
| <option value="User error">User error</option> | ||
| </select> | ||
| </p> | ||
| <g:dialog_buttons_ok_cancel ok_text="${gs.getMessage('Submit')}" ok_title="${gs.getMessage('Submit')}" ok="return ResolveIncidentOnsubmit('${jvar_sys_id}');" ok_style_class="btn btn-primary" cancel_text="${gs.getMessage('Cancel')}" cancel_title="${gs.getMessage('Cancel')}" cancel="return closeDialog(); disable" /> | ||
| </div> | ||
| </j:jelly> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Please mention as a comment in below code on where below code will be used.
I can see 2 seperate codes for UI Action, keep the necessary one and remove the file which is not requ
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.
@rohi-v i dont see any two files which one you are referring

Uh oh!
There was an error while loading. Please reload this page.
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.
It's updated now. Thank you.
there were 2 codes so specifying which one to use where will help because the method name 'ResolveIncident()' is same in both the scripts.
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.
@rohi-v updated the function name.