Fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2023 04:36 AM
Hi,
May I know the way how we can find the empty data/fields on any table and fix them or replace them using the fix script.
Thanks,
Rupali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2023 04:19 AM
Hi @Manu143 ,
Please see the below sample script to fix the data using the fix script:
Sample Code:
var gr = new GlideRecord('table name');
gr.addEncodedQuery('the query for the records that needs to be updated.');
gr.query();
while(gr.next()){
var fn = gr.fieldname; // before update the value of gr.fieldname
gr.fieldname = "32 digit sys_id that you need to update" OR "value that needs to update";
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
gs.info("@@RecordNumber:"+gr.number+"/Before Update:"+fn+"/ After Update:"+gr.fieldname);
}
In system logs, you can verify the List of records updated/field value before the update & after the update to verify whether the records are correctly updated or not.
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.
Thanks & Regards
Jyoti Jadhav