Reference List Display Problem

plallema
Tera Expert

I was on vacation last week and upon my return i find that all fields referencing the User table (sys_user) when clicking on the lookup icon, gives me a pop up list with no records. I've been searching all over the place as to what can be the problem and to no avail. The problem doesn't exist on my development instance. Now the help desk is stuck not being able to assign other user to a ticket in incident and problem and change is affected as 'assign to' field references the User table.

1 ACCEPTED SOLUTION

CapaJC
ServiceNow Employee
ServiceNow Employee

You might try the following script that might fix the dictionary record, bypassing the Business Rule that's preventing you from changing it.



doit();
function doit() {
var gr = new GlideRecord('sys_dictionary');
gr.addQuery("name", "sys_user");
gr.addQuery("element", "first_name");
gr.query();
if (gr.next()) {
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.internal_type = "string";
gr.reference = "";
gr.update();
}
}


View solution in original post

10 REPLIES 10

plallema
Tera Expert

Well i figured out the problem was do to the fact that someone made the field 'first name' in sys_user table a reference field and did not specify a table. I found this out trying to create a user and the sys_user table refusing to save the first name. I tried to revert the 'first name' field back to string but got an error refusing to do so. I listed the sys_user table as the reference and everything started work fine. However I'm worried about a field on a table referencing itself. Would like to change the field back to a regular string field. Hey Chris Thanks a lot it was trying to create a log in for you that made me discover the issue.


CapaJC
ServiceNow Employee
ServiceNow Employee

You might try the following script that might fix the dictionary record, bypassing the Business Rule that's preventing you from changing it.



doit();
function doit() {
var gr = new GlideRecord('sys_dictionary');
gr.addQuery("name", "sys_user");
gr.addQuery("element", "first_name");
gr.query();
if (gr.next()) {
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.internal_type = "string";
gr.reference = "";
gr.update();
}
}


I'm currently in a situation similar to plallema and this looks like it might solve my problem. I have a field that is set to reference when it should be a string.



Unfortunately I'm not entirely sure where to run this script from. Can you give me a quick hint?


Sorry Matt didn't see your question til now. Just elevate yourself by clicking the lock next to your name..assuming your an admin. Once elevated just type Background Scripts, it is under System Definition. Copy the code above paste into the Run Script Window. Click Run Script button and it should do the trick.


Didn't elevate my permissions (and thus couldn't see the Background Scripts). That's what I was missing.



This worked for me. Thank you very much!!