- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:38 AM
Hello Everyone
In incident list view for some incidents location is empty but location value present in form view.
Please suggest
@Dr Atul G- LNG
@Community Alums
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 02:50 AM
Hi @Vinod S Patil ,
Check all below possibilities,
If the data is not saved in the database it will look empty in the list view, so once you load the form or open form try saving it and then go to list view and check,
Or
the data might be populating through business rule and current.update() is not included
Support article,
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0725733
if the field is reference check below article,
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0758245
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
03-20-2024 02:57 AM
Hi @Vinod S Patil,
Believe it or not, this is not uncommon and typically seen when a field is populated on load or has a default value however the record has not been saved since the the onLoad Script or Default field logic has been implemented.
A great way to check this is to open one of the records which displays an empty value in the list view yet has a value when you open the record on the form.
At the top of the record (In the form view), right-click to pop up a menu and click on 'View XML' - this will show you what is actually stored at the DB level of the record at the time. If you see that the location field is empty in the XML but visible on the form, this means the record has indeed not been updated since the logic / default value has been set.
You may need to create a fix script to handle these records to ensure historical records reflect current data logic.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:38 AM - edited 03-20-2024 07:39 AM
Hi @Vinod S Patil,
Use the below script (Ready to copy and paste into the Background script console):
(Notice I've placed a temporary INC number to test with before you run on all records. Cahn get this number to an incident that matches the empty criteria on your instance)
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.
Thanks, Robbie
var testRecordCounter = 0; //Counter to check result set from GR query below is correct. (Number of records is the same)
var testRecordToUpdate = 'INC0010034'; //A test record to test the script works ok before running on all records - update to whatever INC record matches the empty criteria on your instance
var encQ = 'location=NULL';
var ingGRLocUpdate = new GlideRecord('incident');
ingGRLocUpdate.addEncodedQuery(encQ);
ingGRLocUpdate.addQuery('number', testRecordToUpdate); //Comment this line out once happy with the single update
ingGRLocUpdate.query()
while(ingGRLocUpdate.next()){
testRecordCounter++;
var callerLocation = ingGRLocUpdate.caller_id.location;
//gs.info('Test record number check: ' + ingGRLocUpdate.number.getDisplayValue());
//gs.info('User location value: ' + callerLocation.getDisplayValue());
if(callerLocation){ //Only update the incident if the caller has a location set
ingGRLocUpdate.setWorkflow(false);
ingGRLocUpdate.location = callerLocation;
ingGRLocUpdate.update();
}
}
gs.info('Test Record Counter to ensure correct result set BEFORE updating: ' + testRecordCounter);