Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2024 05:05 AM
I managed to get it to work by using the following script:
//Search for any Business Applications that are Not in Scope with an 'AMA rating' of Enhanced and where the 'Last scoping AMA completed date' field is different to the 'Next AMA due date' field
var enhancedApp = new GlideRecord('cmdb_ci_business_app');
enhancedApp.addEncodedQuery('u_next_ama_due_dateNSAMEASu_last_scoping_ama_completed_date@day^u_in_scope_for_controls=not_in_scope^u_access_management_controls=enhanced');
enhancedApp.query();
while(enhancedApp.next()) {
//If any business applications return from the search, add 365 days to the 'Last scoping AMA completed date' date field
var enhancedScopingDate = enhancedApp.u_last_scoping_ama_completed_date;
var enhancedGdt = new GlideDateTime(enhancedScopingDate);
enhancedGdt.addDaysLocalTime(365);
enhancedApp.setValue('u_next_ama_due_date', enhancedGdt);
//Update the 'Next AMA due date' field with the new date
enhancedApp.update();
}