Workspace Reference field shows Sys IDs instead of the Display Value

Jay D1
Tera Guru

Hello,

I have a reference field with a reference qualifier (javascript:new ScriptInclude().myFuncMatrix();) looking at a Script Include. On the UI Form, I am getting the correct display values while on the workspace, I get the Sys IDs (Screenshot below).

find_real_file.png

myFuncMatrix: function() {
		var letterList = '';

		var choiceSysID = new GlideRecord('sys_choice');
		choiceSysID.addEncodedQuery('element=subcategory^name=table_name_A^dependent_value=4^value=' + current.subcategory);
		choiceSysID.query();

		while(choiceSysID.next()){

			var gr = new GlideRecord('table_name_B');
			gr.addEncodedQuery('table_name_B_subcategoryLIKE' + choiceSysID.getUniqueValue());
			gr.query();

			while(gr.next()) {
				if (myFunc.length > 0) {
					myFunc+= (',' + gr.sys_id).toString();
				} else {
					myFunc = gr.sys_id.toString();
				}
			}
			return 'sys_idIN' + letterList;
		}
	},
1 ACCEPTED SOLUTION

Hi,

I tested this before I replied, I don't usually just reply with random things on the forums here, but when I adjusted the popup view in the standard UI, it was reflected upon reload within the Workspace.

Example:

I navigate to an Incident record in standard UI, click the magnifying glass for "Caller" field to see popup view:

find_real_file.png

I navigate to Agent Workspace, Incident record, Caller field, popup is:

find_real_file.png

I go back to Incident, standard UI, remove the email field from Caller popup:

find_real_file.png

Go back to Agent Workspace, refresh, click Caller reference again:

find_real_file.png

So, anyways, it's controlled from the same place. Normally, when you first create a brand new table, and you go to access a reference field that points to it, it shows just the sys_id column initially.

Once you create the popup view, it shows what you've set.

I don't know if this is a custom table that's being pointed to or maybe you had a table defined, but then removed it, and so the Workspace UI is not picking that up. Since you're using a reference field is a different way, by adding choices to it, instead of it pointing to a table, there may be some issues there.

You can temporarily add a table back to the reference field, then check Standard and Workspace UIs and see if they align.

Then, swap back and remove that table reference, and see if that resolves anything. You can also try clearing your instance cache by typing: cache.do and pressing enter in left-hand navigation.

You can check the URL in the popup in standard UI and see what table it's pointing to, is that correct?

The Workspace UI may be pointing to a different table and so it's not the same table, thus the popup view is different. Workspace could be looking at sys_choice, whereas your standard UI may be looking at a different table?

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

9 REPLIES 9

Allen Andreas
Administrator
Administrator

Hi,

My apologies, your post is a bit confusing.

If you're looking at the sys_id column, then it's going to show sys_ids...?

Additionally, you'd want to ensure this table as the appropriate "display" value marked "true" for the field in which you want to be the display field (so, like the Name field, for example).

You're saying in the standard UI, it's showing correctly with the display value you expect to see?

But in Workspace, it's not? Workspace is currently showing the sys_id column, so thus the sys_ids will show. You'd want to show another column in the layout.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Well, its a "Reference" type field with "Choice" as "Dropdown with -- None -- ". I would assume that it would render the same in the Workspace but it didn't. 

I did try to return the display value instead of the Sys ID but the list became "empty".

Also, I do currently have the "Display" as "true" on a field that I expect to show.

I tried this as below

myFuncMatrix: function() {
		var myFuncName = '';

		var choiceSysID = new GlideRecord('sys_choice');
		choiceSysID.addEncodedQuery('element=subcategory^name=table_name_A^dependent_value=4^value=' + current.subcategory);
		choiceSysID.query();

		while(choiceSysID.next()){

			var gr = new GlideRecord('table_name_B');
			gr.addEncodedQuery('table_name_B_subcategoryLIKE' + choiceSysID.getUniqueValue());
			gr.query();

			while(gr.next()) {
				if (myFuncName.length > 0) {
					myFuncName += (',' + gr.u_name_field).toString();
				} else {
					myFuncName = gr.u_name_field.toString();
				}
			}
			return 'u_name_fieldIN' + myFuncName;
		}
	},

Hi,

The other thing I mentioned is that you're looking at the sys_id column...so in your screenshot in your original post (the top screenshot), it's showing you looking at the sys_id column, specifically. So it's going to show you sys_ids.

You'd want to change that to show the display field you'd expect. Your script include has nothing to do with what column is displaying there (it just changes what records show...but not the column itself). You'd have to change that.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!