After Business Rule Issue incident creates a problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 04:03 AM
Hi,
My requirement is to create a problem through an incident when the user changes the incident state to onHold. It is not creating any problem record at all. Kindly help.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('problem');
gr.initialize();
gr.short_description = 'After Business Rule';
gr.description = 'After Business Rule';
gr.first_reported_by_task = '9d3c1197c611228701cd1d94bc32d76d';
gr.insert();
gs.addInfoMessage('The problem created is ' + gr.number);
action.setRedirectURL(current);
})(current, previous);
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 04:08 AM
Check if there are any mandatory fields on Problem , that you are not entering in your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 04:09 AM
This seems like a great use case for a simple Flow with zero code. Eliminate code as the point of failure alltogether.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 04:12 AM
Hi @Community Alums
Did you check for existing mandatory fields for problem table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 04:16 AM
What kind of process is this? An incident is set to On Hold and that creates a problem? That's very weird logic and I would first challenge this requirement before spending any more time on this.
But that being said: I just copied your code into my PDI (OOB ITSM processes) and it immediately created a Problem.
Check your logs to see what is happening. Check the problem logic to see if there is something blocking problems from being created (like a mandatory field that needs to be filled, or it aborts the creation). OOB your code works fine, so it must be something custom in your instance that is blocking it.