Make problem_id field editable in incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 12:48 AM
Hi,
when an incident is set to State = Closed, all fields become read-only for an itil user.
I have a requirement to make the field problem_id editable for closed incidents.
Via trial and error I achieved it in a PDI via ACL changes, but it made several other fields editable from the list view (such as State, allowing the user to reopen closed incidents) which is not acceptable.
Can anyone help me with the solution to make ONLY the problem_id field editable for the itil user?
many thanks in advance - Parker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 12:20 PM
Hi @phenkry ,
Did you tried my solution which I have provided above?
If my response helped, then accept the solution and hit the thumbs up, so that it benefits the future reader and also me for your efforts towards the community.
Regards,
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 01:06 AM
Hi @Rohit Singh yes i did but it doesn't work since the OOB incident.none write ACL blocks it (closed, cancelled), and if I remove that I get an unacceptable side effect, which is that an incident with status closed can be reopened in the list view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:22 AM
This I already informed yesterday
Another workaround is this -> No need to touch any ACL etc
1) create a UI action which is shown only when INC is closed
2) on click of that UI action, open a UI page and ask user to select problem from reference field
3) once UI page is submitted, use GlideRecord to update the problem_id field
4) This will work as ACLs are not evaluated while using GlideRecord
GlideDialogWindow: Advanced Popups Using UI Pages
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 04:37 AM
Something like this worked for me, please enhance
I hope I have answered your question and you can enhance it further from here.
UI Action:
function setProblem() {
var sysId = g_form.getUniqueValue(); // Get the Incident record's sys_id
var gDialog = new GlideDialogWindow('set_problem_closed_inc'); // Reference your UI Page name
gDialog.setTitle('Select Problem');
gDialog.setPreference('sysparm_incident_sys_id', sysId); // Pass Incident sys_id to the UI Page
gDialog.render(); // Render the dialog window
}
UI Page:
HTML:
<?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:ui_form>
<g:evaluate var="jvar_incidentSysId" expression="RP.getWindowProperties().get('sysparm_incident_sys_id')" />
<input type="hidden" id="incSysId" value="${jvar_incidentSysId}"/>
<!-- Reference Field for Problem Table -->
<g:ui_reference name="problem_ref" id="problem_ref" table="problem" completer="AJAXTableCompleter" label="Select Problem" />
<g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
</g:ui_form>
</j:jelly>
Client Script:
function onSubmit() {
var problemSysId = gel('problem_ref').value; // Get selected Problem sys_id
var incidentSysId = gel('incSysId').value; // Get Incident sys_id
if (problemSysId) {
var ga = new GlideAjax('UpdateIncidentProblem');
ga.addParam('sysparm_name', 'updateProblemField');
ga.addParam('sysparm_incident_sys_id', incidentSysId);
ga.addParam('sysparm_problem_sys_id', problemSysId);
ga.getXMLAnswer(function(response) {
GlideDialogWindow.get().destroy(); // Close dialog
window.location.reload(); // Refresh form to show updated field
});
} else {
alert('Please select a Problem record.');
}
}
Script Include: It should be client callable
var UpdateIncidentProblem = Class.create();
UpdateIncidentProblem.prototype = Object.extendsObject(AbstractAjaxProcessor, {
updateProblemField: function() {
var incidentSysId = this.getParameter('sysparm_incident_sys_id');
var problemSysId = this.getParameter('sysparm_problem_sys_id');
if (incidentSysId && problemSysId) {
var grIncident = new GlideRecord('incident');
if (grIncident.get(incidentSysId)) {
grIncident.problem_id = problemSysId; // Update problem_id field
grIncident.update();
return 'Problem updated successfully.';
}
}
return 'Failed to update Problem.';
},
type: 'UpdateIncidentProblem'
});
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2025 08:02 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader