- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 08:57 AM
Can someone help me tweek this Fix Script? It's not updating the records.
Requirement : Create and run a fix script that will change the Source field value for all existing Security Incidents (active or inactive) currently having a Source field displayed as self_service, so that the field will correctly display Self-service.
source field backend value is "contact_type"
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 11:22 AM
@Snow Angel Try with the following and see if it works.
var gr = new GlideRecord('sn_si_incident');
gr.addQuery('contact_type', 'self_service');
gr.query();
while (gr.next()){
gr.contact_type.setDisplayValue('Self-service');
gr.update();
}
gs.print("Fix script execution completed.");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 09:12 AM
Hi @Snow Angel ,
while updating you will have to give the backend value of Self- service so try giving gr.contact_type ='self-service'
var gr = new GlideRecord('sn_si_incident');
gr.addQuery('contact_type', 'self_service');
gr.query();
while (gr.next())
{
gr.contact_type = 'self-service';
gr.update();
}
gs.print("Fix script execution completed.");
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 09:14 AM
@Snow Angel and try addEncodedQuery instead of addQuery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 11:22 AM
@Snow Angel Try with the following and see if it works.
var gr = new GlideRecord('sn_si_incident');
gr.addQuery('contact_type', 'self_service');
gr.query();
while (gr.next()){
gr.contact_type.setDisplayValue('Self-service');
gr.update();
}
gs.print("Fix script execution completed.");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 07:23 AM
Thank you Sandeep! It has worked.