Is it possible to make Comments mandatory on incident form of service portal while reopening the inc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2025 11:02 AM
Hi there,
I have a requirement to make comments mandatory if end user tries to reopen the incident by using "Reopen" ui action on service portal.
Is it feasible to achieve? if yes the how? if not, could you please share any servicenow document stating the same?
Thank!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2025 02:01 PM
This is from the OOB UI Action named "Reopen" defined on the incident table:
// Client side onclick function
function reopenIncident() {
if (g_form.getValue('comments') == '') {
g_form.setMandatory('comments', true);
}
gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); // MUST call the 'Action name' set in this UI Action
}
// Code that runs without 'onclick'
// Ensure call to server side function with no browser errors
if (typeof window == 'undefined')
serverReopen();
function serverReopen() {
// Set Incident state to active, update and reload the record
current.incident_state = 2;
current.state = 2;
current.update();
var msg;
if (current.child_incidents > 0) {
msg = gs.getMessage("{0} and its child incident(s) have been reopened", current.getDisplayValue());
} else {
msg = gs.getMessage("{0} has been reopened", current.getDisplayValue());
}
gs.addInfoMessage(msg);
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2025 07:50 PM
this link has solution for portal, check and enhance as per your requirement
Create Reopen Incident Widget which requires comments for Service Portal
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader