- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 06:36 PM
Hello, I am trying to make a BR to prevent P1 incident creation if the CI is not something specific.If the user selects another CI it should throw an error "Please select the CI as XX to create a P1 record". This is what I got so far:
But is not saving the ticket even when the CI is set to the specified CI. Can someone assists with this? Thank you in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 05:03 AM
You shouldn't need a GlideRecord. This sounds like you want a before Insert Business Rule on the incident table. Your script would look more like this:
(function executeRule(current, previous /*null when async*/ ) {
if (current.cmdb_ci != 'd0e8761137201000deeabfc8bcbe5da7' && current.priority == 1){
current.setAbortAction(true);
gs.addErrorMessage('Please select the CI as *DENNIS-IBM to create a P1 record');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 05:03 AM
You shouldn't need a GlideRecord. This sounds like you want a before Insert Business Rule on the incident table. Your script would look more like this:
(function executeRule(current, previous /*null when async*/ ) {
if (current.cmdb_ci != 'd0e8761137201000deeabfc8bcbe5da7' && current.priority == 1){
current.setAbortAction(true);
gs.addErrorMessage('Please select the CI as *DENNIS-IBM to create a P1 record');
}
})(current, previous);