I understand that you are encountering an issue where your name is appearing in the "Assigned to", "Support group", "Location", and other fields in the audit history after running a fix script in ServiceNow. Below is a general guideline on how you can analyze and debug your fix script. If you can provide the actual script you're using, I can give more specific feedback.
Without seeing the actual script, I can offer the following generic steps to troubleshoot:
-
Check the Script Context: When running a fix script, ensure that you are not inadvertently setting fields to your user session. The script will run in the context of the user who initiated it (you), so if the script assigns values without explicitly stating what those values should be, it might assign your user defaults.
-
Review Script Logic: Ensure the script is logically altering only the desired fields and for the correct records.
Here is a sample fix script that changes a specific field without affecting other fields like "Assigned to", "Support Group", or "Location":
// Example for updating names in 'sys_user' table without affecting other fields.
var userGr = new GlideRecord('sys_user');
userGr.query(); // Modify the query as per your requirements
while (userGr.next()) {
userGr.name = "New User Name"; // Change this to the intended name change logic
// Ensure that only the `name` field is updated
userGr.update();
}
Steps for analyzing the issue:
- Run in Scope: Ensure that you're running the script in the correct application scope.
- Explicit Field Setting: Ensure the script is setting only the intended field and not other fields like "Assigned to", "Support Group", "Location".
To help ensure other fields aren't affected, you might be more explicit in which fields you are changing or updating:
var gr = new GlideRecord('your_table');
gr.query();
while (gr.next()) {
gr.name = "New Name"; // Change this line to update any specific field
gr.setWorkflow(false); // Optional: to prevent triggers which might inadvertently update other fields
gr.setAudit(false); // Optional: if you do not want this change to be captured in audit logs
// Update only the specific field:
gr.autoSysFields(false);
var fieldsToUpdate = ['name']; // specify which field(s) to update
gr.setFields(fieldsToUpdate);
gr.update();
}
Check for update triggers or business rules: Make sure no business rules or workflows are triggered from the update operation that may inadvertently set the "Assigned to", "Support Group", or "Location" fields to your name.
- Right-click on the record form and choose "Show XML": Before and after running your script, compare the XML output to ensure that only the intended fields are changed.
If you share the exact fix script you are using, I can provide a more in-depth review and offer more precise advice.