Satishkumar B
Giga Sage

Hi @matthew_hughes 

 

// Initialize GlideRecord for cmdb_ci_business_app table
var app = new GlideRecord('cmdb_ci_business_app');

// Add encoded query to filter records
app.addEncodedQuery('u_in_scope_for_controls=not_in_scope^number=AL05053'); // Adjust this query as per your requirements
app.query(); // Execute the query

// Loop through each record matching the query
while (app.next()) {
// Retrieve the value of 'u_last_scoping_ama_completed_date' and add a year
var lastScopingDate = new GlideDateTime(app.u_last_scoping_ama_completed_date);
lastScopingDate.addYearsUTC(1);

// Set the value of 'u_next_ama_due_date' to the calculated date
app.u_next_ama_due_date = lastScopingDate;

// Update the record
app.update();
}

 

----------------------------------------
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.