Skip to content

Warn before closing incident without work notes#2018

Closed
harshal045 wants to merge 3 commits intoServiceNowDevProgram:mainfrom
harshal045:Warn-Before-Closing-Incident-Without-Work-Notes
Closed

Warn before closing incident without work notes#2018
harshal045 wants to merge 3 commits intoServiceNowDevProgram:mainfrom
harshal045:Warn-Before-Closing-Incident-Without-Work-Notes

Conversation

@harshal045
Copy link
Contributor

Warn Before Closing Incident Without Work Notes

Overview

This Client Script prevents users from resolving or closing an Incident without adding work notes. It ensures that important resolution details are documented before the ticket is closed.

Features

  • Triggered on form submission.
  • Checks if the Incident state is set to Resolved or Closed.
  • Displays a warning if Work Notes are empty.
  • Prevents form submission until notes are added.

Configuration

  • Table: incident
  • Type: onSubmit
  • Script Name: Warn Before Closing Without Work Notes
  • Active: true

Script

function onSubmit() {
var state = g_form.getValue('state');
var workNotes = g_form.getValue('work_notes');

if ((state == '6' || state == '7') && !workNotes.trim()) {
    alert("Please add work notes before resolving or closing the Incident.");
    return false;
}

return true;

}

@rohi-v rohi-v self-assigned this Oct 11, 2025
@harshal045
Copy link
Contributor Author

Can you please check and review it

@github-actions
Copy link

👋 Unassigning @rohi-v due to inactivity (> 60 min without comments/reviews). This PR remains open for other reviewers.

@rohi-v rohi-v self-assigned this Oct 11, 2025
@rohi-v
Copy link
Contributor

rohi-v commented Oct 11, 2025

Hi @harshal045

Thank you for contributing!

We appreciate the effort you’ve put into this contribution. Since this is your first PR, we’ve labeled it as hacktoberfest-accepted so it still counts toward your Hacktoberfest progress.

For Hacktoberfest, we’re aiming for high-quality contributions providing real-world use developer cases.You can check some of the recently merged code snippets for reference. They are good examples of what we're aiming for.

@rohi-v rohi-v closed this Oct 11, 2025
@rohi-v rohi-v added the hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not label Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted The PR is accepted for Hacktoberfest, regardless of being merged or not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants