- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 09:15 AM
Hi All,
have a requirement that i need to restrict the user be applied cmdb ci outage records that will allow the record to be modified up to 72 hours after the recorded End Date/Time by any ITIL user. After 72 hours from the End Date/Time, the modification can only be performed by group members of these select groups:
Cloud Outage group
OnPrem Outage group
Admin group
In addition, if a user wants to modify the Unplanned Outage record after the 72 hours and they are not a member of one of the approved groups, display the following message,
“Users cannot modify Outage records more than 72 hours past the recorded End Date/Time. If you need this record modified, please navigate to the Service Catalog and select the “Modify Outage Record” request.”
Please help me on this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 11:50 AM
Hi @msc ,
This can be done through a before update business rule. I have shared the script and screenshot of the error when other users tries to update the outage which is more than 72 hours. I am not validating the ITIL role as the ACL's by default will not allow other users to access outage records, if required you can add.
Let me know in case if you have any further queries.
If the solution shared works for you, please "Accept as Solution" and mark " Helpful."
Thanks,
Gummagatta Harshavardhana
Before update business rule script -
var begin = new GlideDateTime(current.begin); //outage begin date
var end = new GlideDateTime(current.end); // outage end date
// Duration in hours
var dur_seconds = gs.dateDiff(begin, end, true); // returns the number of seconds as String
var dur_hours = Math.round(dur_seconds / 3600); // Math.round() is optional and will round the number to the nearest integer
if (dur_hours > 72) {
if (!(gs.getUser().isMemberOf('Hardware') || gs.getUser().isMemberOf('OnPrem Outage group') || gs.getUser().isMemberOf('Admin group'))) {
current.setAbortAction(true);
gs.addErrorMessage('Users cannot modify Outage records more than 72 hours past the recorded End Date/Time. If you need this record modified, please navigate to the Service Catalog and select the Modify Outage Record request');
}
}
})(current, previous);
Error Screenshot -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 11:50 AM
Hi @msc ,
This can be done through a before update business rule. I have shared the script and screenshot of the error when other users tries to update the outage which is more than 72 hours. I am not validating the ITIL role as the ACL's by default will not allow other users to access outage records, if required you can add.
Let me know in case if you have any further queries.
If the solution shared works for you, please "Accept as Solution" and mark " Helpful."
Thanks,
Gummagatta Harshavardhana
Before update business rule script -
var begin = new GlideDateTime(current.begin); //outage begin date
var end = new GlideDateTime(current.end); // outage end date
// Duration in hours
var dur_seconds = gs.dateDiff(begin, end, true); // returns the number of seconds as String
var dur_hours = Math.round(dur_seconds / 3600); // Math.round() is optional and will round the number to the nearest integer
if (dur_hours > 72) {
if (!(gs.getUser().isMemberOf('Hardware') || gs.getUser().isMemberOf('OnPrem Outage group') || gs.getUser().isMemberOf('Admin group'))) {
current.setAbortAction(true);
gs.addErrorMessage('Users cannot modify Outage records more than 72 hours past the recorded End Date/Time. If you need this record modified, please navigate to the Service Catalog and select the Modify Outage Record request');
}
}
})(current, previous);
Error Screenshot -