Fix script

Manu143
Tera Contributor

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

1 REPLY 1

Jyoti Jadhav9
Tera Guru

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