fix script to update 2 fields in multiple incident records

Sam M3
Tera Contributor

Hi,
I want to create a fix script to update 2 empty fields "u_primary_contact_number" and "u_resolution_method"(see attachment) with "N/A" in  1000+ incident records. I am not proficient in scripting.  thanks
Update - I tried the proposed fix script below but it didn't not working

 

SamM3_1-1679346345611.png

 

1 ACCEPTED SOLUTION

Ashir Waheed
Kilo Sage
Kilo Sage

Hi @Sam M3 

 

Follow these step to write your script to update the records.

 

1. Go to the incident list view of records and filter the record "Primary_number is Emplty" and "Resolution is empty".

2. Run the filter then Right Click on the Query and Select "Copy Query".

Screen Shot 2023-03-20 at 3.34.11 PM.png

3. Write the FIX Script as follow. (Replace Encoded query with copied query).

4. In the Application Navigator, Navigate to System Definition->Fix Script.

5. Create a New record

AshirWaheed_0-1679342171477.png

 

6. Click on the RUN FIX SCRIPT, You should be good to go.

 

 

Regards,

Ashir Waheed

 

 

View solution in original post

2 REPLIES 2

Yousaf
Giga Sage

Hi SAM,
You can try something like this. You can use any query you want to filter the record and change the name of table as needed.

 

var gr = new GlideRecord('incident');
gr.addQuery();
gr.query();
while(gr.next()){
gr.caller_id = gs.getUserID();
gr.primary_number = "N/A";
gr.resolution = "N/A";
gr.update();
}

 

 

Mark Correct and Helpful if it helps.


***Mark Correct or Helpful if it helps.***

Ashir Waheed
Kilo Sage
Kilo Sage

Hi @Sam M3 

 

Follow these step to write your script to update the records.

 

1. Go to the incident list view of records and filter the record "Primary_number is Emplty" and "Resolution is empty".

2. Run the filter then Right Click on the Query and Select "Copy Query".

Screen Shot 2023-03-20 at 3.34.11 PM.png

3. Write the FIX Script as follow. (Replace Encoded query with copied query).

4. In the Application Navigator, Navigate to System Definition->Fix Script.

5. Create a New record

AshirWaheed_0-1679342171477.png

 

6. Click on the RUN FIX SCRIPT, You should be good to go.

 

 

Regards,

Ashir Waheed